Olaf Kock 8年 前 I like the fake entity with the fake datasource - I've been using empty entities, but this means that model beans have to be totally hand-written, adding more work. This is a good alternative. Thanks for the pointer 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger Olaf Kock 8年 前 Empty entities are great for layering in business logic, but you're stuck using primitives, their Object counterparts, Collections or Entities.The Fake Entity lets you add your own custom classes that are not database-dependent. 投票するためにはログインが必要です。 次として送信する: キャンセル
David H Nebinger Olaf Kock 8年 前 Empty entities are great for layering in business logic, but you're stuck using primitives, their Object counterparts, Collections or Entities.The Fake Entity lets you add your own custom classes that are not database-dependent. 投票するためにはログインが必要です。 次として送信する: キャンセル
Jack Bakker 8年 前 using SB for servicing requests to more than that involving sql tables 投票するためにはログインが必要です。 次として送信する: キャンセル
Daniele Baggio 8年 前 Good post, it's time to use this useful thinks. 投票するためにはログインが必要です。 次として送信する: キャンセル
Prakash Khanchandani 8年 前 Loved it! Thank you for collating and adding your own expertise .. all at one place.can't get easier than this.Thank you 投票するためにはログインが必要です。 次として送信する: キャンセル
Prakash Khanchandani 8年 前 Should be a wiki or tutorial in dev.liferay.com :-) 投票するためにはログインが必要です。 次として送信する: キャンセル
Philip Teagle 8年 前 Not sure if this applies to the use case in which you need to add a Service layer using Service Builder around an existing DB used by a group of Liferay portlets. I have been waiting for someone to crack the reverse engineer a DB into a service.xml, similar to Dali tools reverse engineering a JPA persistence.xml from database tables. 投票するためにはログインが必要です。 次として送信する: キャンセル
Tahir Noor Khaliq 8年 前 can v use composition in fake entity 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger Tahir Noor Khaliq 8年 前 There's no magic to fake entities. They have the same features and constraints as regular entities. Contained collections within an entity typically give SB problems because there's no easy way to manage crossing the class loader boundary with those, so you'll frequently get the operation not supported exception. 投票するためにはログインが必要です。 次として送信する: キャンセル
David H Nebinger Tahir Noor Khaliq 8年 前 There's no magic to fake entities. They have the same features and constraints as regular entities. Contained collections within an entity typically give SB problems because there's no easy way to manage crossing the class loader boundary with those, so you'll frequently get the operation not supported exception. 投票するためにはログインが必要です。 次として送信する: キャンセル
Vicente Soriano 8年 前 Thank you, David, for this entry blog. I've implemented two Fake Entities with 6.2 EE using the persistence layer for caching purposes, and they're working perfectly.As you said, I needed to implement the "NullDataSource" fix you talked about. 投票するためにはログインが必要です。 次として送信する: キャンセル
amir keshavarz 7年 前 Brilliant. Thanks David.Can you please describe more how we can code NullDataSource. 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger amir keshavarz 7年 前 class NullDataSource implements DataSource {}, then you'll have to implement a slew of methods from the interface, any time they return something just return null. I didn't include it in the code because it actually is just that easy. 投票するためにはログインが必要です。 次として送信する: キャンセル amir keshavarz David H Nebinger 7年 前 Thank you so much David. It works very well. 投票するためにはログインが必要です。 次として送信する: キャンセル
David H Nebinger amir keshavarz 7年 前 class NullDataSource implements DataSource {}, then you'll have to implement a slew of methods from the interface, any time they return something just return null. I didn't include it in the code because it actually is just that easy. 投票するためにはログインが必要です。 次として送信する: キャンセル amir keshavarz David H Nebinger 7年 前 Thank you so much David. It works very well. 投票するためにはログインが必要です。 次として送信する: キャンセル
amir keshavarz David H Nebinger 7年 前 Thank you so much David. It works very well. 投票するためにはログインが必要です。 次として送信する: キャンセル
(あなた) 6年 前 [...] Olaf Kock: The fake entity concept means that you're building an empty entity, with no properties. This will not create a table in the database, just make the service available. No, the "fake... [...] Read More 投票するためにはログインが必要です。 次として送信する: キャンセル
Kalai Arasan 4年 前 Can we follow the same in Liferay 7. when I am trying to create fake service in LR7 it's throwing Null pointer exception while accessing the service from portlet. 投票するためにはログインが必要です。 次として送信する: キャンセル Olaf Kock Kalai Arasan 4年 前 David covered this in the latest Radio Liferay Episode 62 http://radioliferay.com/episode/62 . In short: A classic OSGi Declarative service suffices if you don't need any entity or other ServiceBuilder related handling. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan Olaf Kock 4年 前 Hi Olaf, Thankyou for your updates. I need to create a finder with custom sql joins, that's the reason looking for fake service builder. Can we implement multiple sql joins with OSGI declarative services? 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger Kalai Arasan 4年 前 That doesn't call for a fake entity. If you are returning the entity or a list of the entity, you can build custom SQL or a DQ to handle the join and Hibernate/SB will handle the rest of the marshaling effort. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan David H Nebinger 4年 前 Thankyou David! I followed this documentation https://help.liferay.com/hc/en-us/articles/360017882012-Custom-SQL#step-1-specify-your-custom-sql to build custom SQL and it's working fine, only the table is already exist. But actually we don't have any custom table created in our application. We need to join JournalArticle, AssetEntry, AssetCategories and AssetEntries_Assetcategories tables to make a join SQL. I am looking forward to make custom SQL without creating table in database. 投票するためにはログインが必要です。 次として送信する: キャンセル Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル
Olaf Kock Kalai Arasan 4年 前 David covered this in the latest Radio Liferay Episode 62 http://radioliferay.com/episode/62 . In short: A classic OSGi Declarative service suffices if you don't need any entity or other ServiceBuilder related handling. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan Olaf Kock 4年 前 Hi Olaf, Thankyou for your updates. I need to create a finder with custom sql joins, that's the reason looking for fake service builder. Can we implement multiple sql joins with OSGI declarative services? 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger Kalai Arasan 4年 前 That doesn't call for a fake entity. If you are returning the entity or a list of the entity, you can build custom SQL or a DQ to handle the join and Hibernate/SB will handle the rest of the marshaling effort. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan David H Nebinger 4年 前 Thankyou David! I followed this documentation https://help.liferay.com/hc/en-us/articles/360017882012-Custom-SQL#step-1-specify-your-custom-sql to build custom SQL and it's working fine, only the table is already exist. But actually we don't have any custom table created in our application. We need to join JournalArticle, AssetEntry, AssetCategories and AssetEntries_Assetcategories tables to make a join SQL. I am looking forward to make custom SQL without creating table in database. 投票するためにはログインが必要です。 次として送信する: キャンセル Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル
Kalai Arasan Olaf Kock 4年 前 Hi Olaf, Thankyou for your updates. I need to create a finder with custom sql joins, that's the reason looking for fake service builder. Can we implement multiple sql joins with OSGI declarative services? 投票するためにはログインが必要です。 次として送信する: キャンセル David H Nebinger Kalai Arasan 4年 前 That doesn't call for a fake entity. If you are returning the entity or a list of the entity, you can build custom SQL or a DQ to handle the join and Hibernate/SB will handle the rest of the marshaling effort. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan David H Nebinger 4年 前 Thankyou David! I followed this documentation https://help.liferay.com/hc/en-us/articles/360017882012-Custom-SQL#step-1-specify-your-custom-sql to build custom SQL and it's working fine, only the table is already exist. But actually we don't have any custom table created in our application. We need to join JournalArticle, AssetEntry, AssetCategories and AssetEntries_Assetcategories tables to make a join SQL. I am looking forward to make custom SQL without creating table in database. 投票するためにはログインが必要です。 次として送信する: キャンセル Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル
David H Nebinger Kalai Arasan 4年 前 That doesn't call for a fake entity. If you are returning the entity or a list of the entity, you can build custom SQL or a DQ to handle the join and Hibernate/SB will handle the rest of the marshaling effort. 投票するためにはログインが必要です。 次として送信する: キャンセル Kalai Arasan David H Nebinger 4年 前 Thankyou David! I followed this documentation https://help.liferay.com/hc/en-us/articles/360017882012-Custom-SQL#step-1-specify-your-custom-sql to build custom SQL and it's working fine, only the table is already exist. But actually we don't have any custom table created in our application. We need to join JournalArticle, AssetEntry, AssetCategories and AssetEntries_Assetcategories tables to make a join SQL. I am looking forward to make custom SQL without creating table in database. 投票するためにはログインが必要です。 次として送信する: キャンセル Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル
Kalai Arasan David H Nebinger 4年 前 Thankyou David! I followed this documentation https://help.liferay.com/hc/en-us/articles/360017882012-Custom-SQL#step-1-specify-your-custom-sql to build custom SQL and it's working fine, only the table is already exist. But actually we don't have any custom table created in our application. We need to join JournalArticle, AssetEntry, AssetCategories and AssetEntries_Assetcategories tables to make a join SQL. I am looking forward to make custom SQL without creating table in database. 投票するためにはログインが必要です。 次として送信する: キャンセル Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル
Ario Bimo Kalai Arasan 3年 前 - 編集済み Hi, Kalai Arasan! What you mean is you want to throw variable with different entity like in spring boot using nativeQuery, right? For this, you can refer to this article: http://liferayiseasy3.blogspot.com/2015/02/custom-sql-with-two-table_17.html But, if you refer to that articel, you cannot load parameter via api/jsonws (you should load data directly using ajax). because you throw object entity that never declare. I often use create view either via database or table.sql (via liferay) and call them by creating new serviceBuilder and connect the view by connecting to external dataSource (to connect to external dataSource, you can refer to https://help.liferay.com/hc/en-us/articles/360018160911-Connecting-Service-Builder-to-External-Data-Sources). I don't know if it is the best way or not but it works very well for me. Hope it may helps :) 投票するためにはログインが必要です。 次として送信する: キャンセル