Message Boards

« Back to 2.- Usage ( From Xml file to CRUD Portlet)

A simple many to many relationship

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
A simple many to many relationship
Answer
1/13/12 11:06 AM
Hi Everyone,
first of all my best congrats to the staff...i wrote a crud generator years ago on Liferay 5.1 but it was only a quick&dirty way to get raw code for crud portlets: XMLPF is a great project!
I spent a couple of days on the generator, but i wasn't able to find a sample suitable for my needs. I have to map a simple many to many relashionship...sometihg like this:

TABLE USER
userId LONG PK,
userName VARCAHR

TABLE GROUP
groupId LONG PK,
groupName VARCHAR

TABLE USERGROUP
usergGroupId LONG PK
userId LONG
groupId LONG

I tried to setup my xml in different ways, but always get exceptions on compile time due to duplicate methods on persistence classes...can you explain me how to map the relationship above?
Thankyou very much!

RE: A simple many to many relationship
Answer
1/13/12 8:17 PM as a reply to ANdrea Previati.
Hola Andrea,

Welcome to XMLPortletFactory, and thanks for the support.

Actually there is not a many to many relationship, the closest thing is a planned combo box where you can select more than one option, but is long from here. I am working now in the full implementacion of media gallery of liferay 6.1.

If you develop something in that context, please share with us so we can implement it, community help is very much appreciated.

Attached is an image of a presentation showing posible scenarios about relationships.

Saludos, Jack.
Attachment

Attachments: relaciones_soportadas (Small).png (92.9k)

RE: A simple many to many relationship
Answer
1/19/12 9:26 AM as a reply to Jack A. Rider.
Ok Jack, thank you very much for your answer. Actually I have no spare time to code somethign to share, but i would like to contribute because i'm sure that XMLPF is the right way to stop wasting time on coding crud portlets!
If you wish, tell me how can i contribute!
Ciao!

RE: A simple many to many relationship
Answer
1/20/12 7:11 AM as a reply to ANdrea Previati.
ANdrea Previati:
Ok Jack, thank you very much for your answer. Actually I have no spare time to code somethign to share, but i would like to contribute because i'm sure that XMLPF is the right way to stop wasting time on coding crud portlets!
If you wish, tell me how can i contribute!
Ciao!


Thank you very much Andrea, I would ask you to translate to Italian, but another friend from the community (Francesco Scamarcio) allready made it. Lately we are focusing on getting our project to be known by using SEO etc. It would be most usefull if you could install a link and a logo some place at your website.

We prepared a small javascript that will do all the work for you, see it in here : http://www.xmlportletfactory.org/downloads

Thank you again for your contribution.

RE: A simple many to many relationship
Answer
5/6/15 3:33 PM as a reply to Jack A. Rider.
Hello Jack,

I'm wondering if the new 3.0 version of XMLPortletFactory supports many to many relationships.

I have been looking the files in the Examples section and the forum, but I haven't found anything about many to many relationships.

I know that this thread is old, but I prefer ask you about this here than in a new post.

Thank in advance and congratulations for the project, I have been making tests with XMLPortletFactory this week and for CRUD portlets makes a lot of work.

Bartolomé.

RE: A simple many to many relationship
Answer
5/14/15 4:40 PM as a reply to Bartolomé Martínez Román.
Hello again,

I have been trying different approaches to this problem, and this one that you can find below fits my requirements:

We have three entities: Brands, Centers and BrandsXCenters.

We cant' define the many-to-many relationship, but we can:

- Define a Validation in BrandsXCenters for Brands
- Define a Master / Detail for Centers and BrandsXCenters

With this two steps you can:

- Create the Brands.
- Create the Centers & Create the associated BrandsXCenters.

It's not a perfect solution, but controlling in the service implementation that is not possible to create a BrandsXCenters that already exists does the job.

Attached you can find the associated XML.

Hope it helps,

Bartolomé
Attachments: testxpf.xml (5.5k)