Hey Guys ! This blog is the reflection of my experience with liferay.I will be discussing each and every aspect of using liferay so that you can make your own portal with ease.
Thank you Rohit ,but i don't know why it is not working properly .I have five tables 1st table is related to all table i.e it contains some fields which are defined as foreign key for other four tables .I want to know is it possible to have only one service.xml file for creating any number of tables.
Yes for every project that you create , you must have one service.xml. You can have multiple entity tags between the service-builder tags. The above example that i have given is assuming that both the entity tags are within one service-builder tag.
Hello Rohit when adding relationship as you suggested,the database tables remains same.i.e no foreign constraint is there .Iam having one classified table which conatins one field categoryid ,and that column i want to use in category table as a foreign key .Now can you please give me some idea how to add foreign key in category table. Thanks in advance
@Sunny , I am not sure as to why the database relationship is persisting alongwith the mapping in the service.xml. One reason probably would be that Hibernate must be taking care of it. Like , the only reason why this facility has been given is that , in your ChildLocalServiceUtil , a parent object will injected. So you can use both to create your own operations.
Hello Rohit, I want to know is it possible to define relationship between liferay tables and our own custom tables.I want to use user table in my custom table .So is it possible to relate liferay tables with custom tables ? If it possible than please suggest me solution.
You see all the underlying database stuff happens through hibernate. I havent really worked on hibernate so dont know how it happens. But, i guess liferay is independent of what you do in your database. If you any table is missing it automatically creates a fresh new one. Offcourse the data is lost. So you can just give it a try , by creating a Trigger on the User Table and them Modifying contents of your own table depending on the requirement.
Hi rohit ,It seems like it is very difficult to create the related tables in liferay ..May be there will be some type of solution is available ,but i don't want to spend much time on this topic .Thank you for suggesting me . I am facing problem in creating the MVCPortlet can you help me for this .I want to create a struts portlet which interact with database using AUI or YUI.. Thanks in Advance
@ Sunny , you can start from the page liferay Development on my blog to learn MVCPortlet. Liferay guys suggest to make the portlets with that framework only. Struts i havnt tried so cannot really comment on the same.
Thank you Rohit ,but i don't know why it is not working properly .I have five tables 1st table is related to all table i.e it contains some fields which are defined as foreign key for other four tables .I want to know is it possible to have only one service.xml file for creating any number of tables.
ReplyDeleteYes for every project that you create , you must have one service.xml. You can have multiple entity tags between the service-builder tags. The above example that i have given is assuming that both the entity tags are within one service-builder tag.
ReplyDeleteHello Rohit,
ReplyDeleteJust want to ask that in above post,
both entites have same name Parent,
It it ok having same name of multiple entities?
Thanks & Regards
Vipin Bardia
Hello Rohit when adding relationship as you suggested,the database tables remains same.i.e no foreign constraint is there .Iam having one classified table which conatins one field categoryid ,and that column i want to use in category table as a foreign key .Now can you please give me some idea how to add foreign key in category table.
ReplyDeleteThanks in advance
@Vipin
ReplyDeleteMy Bad, The second entity is the Child entity.
You cannot have 2 entities with the same name.
@Sunny ,
ReplyDeleteI am not sure as to why the database relationship is persisting alongwith the mapping in the service.xml.
One reason probably would be that Hibernate must be taking care of it. Like , the only reason why this facility has been given is that , in your ChildLocalServiceUtil , a parent object will injected. So you can use both to create your own operations.
Hello Rohit,
ReplyDeleteI want to know is it possible to define relationship between liferay tables and our own custom tables.I want to use user table in my custom table .So is it possible to relate liferay tables with custom tables ? If it possible than please suggest me solution.
@Sunny ,
ReplyDeleteYou see all the underlying database stuff happens through hibernate. I havent really worked on hibernate so dont know how it happens.
But, i guess liferay is independent of what you do in your database. If you any table is missing it automatically creates a fresh new one. Offcourse the data is lost. So you can just give it a try , by creating a Trigger on the User Table and them Modifying contents of your own table depending on the requirement.
This comment has been removed by the author.
ReplyDeleteHi, Rohit
ReplyDeletei try to implement that in my project. build service successfully. but not able to access parent function from the child as u said above???
This comment has been removed by the author.
DeleteHi rohit ,It seems like it is very difficult to create the related tables in liferay ..May be there will be some type of solution is available ,but i don't want to spend much time on this topic .Thank you for suggesting me .
ReplyDeleteI am facing problem in creating the MVCPortlet can you help me for this .I want to create a struts portlet which interact with database using AUI or YUI..
Thanks in Advance
This comment has been removed by the author.
ReplyDelete@ Sunny , you can start from the page liferay Development on my blog to learn MVCPortlet. Liferay guys suggest to make the portlets with that framework only. Struts i havnt tried so cannot really comment on the same.
ReplyDeleteHi Rohit Salecha
ReplyDeleteWhy you mention parentId as collection in child entity...?