Foren

Create my own DAO.

Yegor Bondar, geändert vor 12 Jahren.

Create my own DAO.

New Member Beiträge: 21 Beitrittsdatum: 23.08.11 Neueste Beiträge
Good day!

I need to create my own domain, which would be stored in a database and access it from a different portlets.
DAO are built on Hibernate.
How best to organize the mechanism of interaction to this DAO in portal?
I have 2 solutions:
1. Create my classes(data, dao),hibernate mapping,hibernate.cfg.xml in the sources of Liferay. Will this work?
2. Write all logic in one portlet and change the views of portlet.

Any other solutions?
Or you have any good advice?

Thank you!
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: Create my own DAO.

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
We have exactly the same kind of thing, Yegor.

So our portlets needed a different database context, so we created all of the stuff for Hibernate, Spring, etc. for accessing our resources. We use a custom database connection, etc. for these portlets. There was no need to integrate the DAOs for Liferay, so we let the standard LR connection, daos, etc. alone.

Works great, and only exposes our DAOs to our portlets, which is what we wanted!
Yegor Bondar, geändert vor 12 Jahren.

RE: Create my own DAO.

New Member Beiträge: 21 Beitrittsdatum: 23.08.11 Neueste Beiträge
You compile your DAO layer in custom jar and then add to classpath of your portlets?
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: Create my own DAO.

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Yep, pretty much. That way the portlets will have access to the DAO classes, but they are not exposed to LR.