Forums de discussion

Sample EJB3 portlet for LIferay

Sam w, modifié il y a 13 années.

Sample EJB3 portlet for LIferay

Liferay Master Publications: 660 Date d'inscription: 03/03/09 Publications récentes
Hi,

Is there any documentation , wiki and tutorial about how to develop EJB3 portlet for Liferay?

Very appreciate for any suggestion and pointers to URL.

Thanks
Sam
mohamed othmani, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

New Member Publications: 7 Date d'inscription: 18/05/12 Publications récentes
hi did find any doc ?
thumbnail
Vitor Silva, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Junior Member Publications: 36 Date d'inscription: 03/05/12 Publications récentes
Implementing EJB3 beans in a JEE server is more related to JEE than Liferay. You can use Liferay MVC and Alloy UI and when submitting your form you will invoke EJB3 session beans for example, obtaining them the same way you will do that with an ordinary Web application. I will recommend to follow EJB3 tutorials.
mohamed othmani, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

New Member Publications: 7 Date d'inscription: 18/05/12 Publications récentes
can you explain more please Vitor
thumbnail
Vitor Silva, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Junior Member Publications: 36 Date d'inscription: 03/05/12 Publications récentes
Ok. you will need basic notions of J2EE. Please follow the tutorial http://docs.jboss.org/ejb3/app-server/tutorial/index.html
EJBs can be created along the same war file as the portlets or be in a separated instance. Once you have you ejb, lets say a SSB "Car". Your Car EJB has a transactional method called "drive". You then have your portlet java class "MyOwnPortlet" that extends from MVCPortlet, during the action phase upon form submission you will obtain a Car ejb from the ejb container and invoke the drive method. This has absolutely nothing to do with Liferay.
thumbnail
Rajesh Chaurasia, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Regular Member Publications: 183 Date d'inscription: 18/08/11 Publications récentes
I developed a portlet that uses JPA entity manager to do crud operations on an entity.I developed a servcie layer that called Dao layer methods and they were annotated with Transactional to demarcate transactions.

I created a portlet class that extended GenericPortlet .Defined RenderMode to be either VIEW, PRINT,EDIT etc and called required jsp files using
getPortletContext().getRequestDispatcher(renderResponse.encodeURL("/countryportlet/view.jsp")).include(renderRequest, renderResponse);
thumbnail
Peter Ruzicka, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Junior Member Publications: 48 Date d'inscription: 07/12/06 Publications récentes
Rajesh Chaurasia:
I developed a portlet that uses JPA entity manager to do crud operations on an entity.I developed a servcie layer that called Dao layer methods and they were annotated with Transactional to demarcate transactions.

I created a portlet class that extended GenericPortlet .Defined RenderMode to be either VIEW, PRINT,EDIT etc and called required jsp files using
getPortletContext().getRequestDispatcher(renderResponse.encodeURL("/countryportlet/view.jsp")).include(renderRequest, renderResponse);



Hello Rajesh.

I am very interested in using Liferay with J2EE6 (EJB3.1, JPA2.0). The main goals are application transactions.

Did you call Liferay API (e.g. for creating documents, tags etc) from Stateless EJBs? Were you able to rollback (your and Liferay) CRUD operations?

I should be very grateful if you provide some sample EJB and GenericPortlet code.

Thank you
thumbnail
David H Nebinger, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Transaction management has nothing to do with whether running in a j2ee container or not.

Liferay manages the transactions itself, the j2ee container will not override that.

There's a note in this thread about wrapping calls to the Liferay APIs in your own transaction that should accomplish what you want. Federico does a good job explaining how it's done...
thumbnail
Peter Ruzicka, modifié il y a 11 années.

RE: Sample EJB3 portlet for LIferay

Junior Member Publications: 48 Date d'inscription: 07/12/06 Publications récentes
Hello David,

Thank you for your fast response.

I don't have to write configuration files with EJB3.0-3.1 - I was waiting for this step in Java for long time.

I also like hooks in Liferay because of code separation (with Spring MVC).

Maybe I don't understand everything good, but I was using Service Builder in 2006 and thought this is not going to be here forever.

Service Builder codes are very Liferay specific for me and code generation from XML files is not my favorite neither.

These days is very common that I need to call many systems from my codes (e.g. LDAP - OIM, WS , OIF etc). It would be very hard if every system/API requires to generate their specific codes.

Distributed application/database transactions are not easy.

My use case is very common:
Liferay Hook,
my specific business logic with DB,
User/Role management from Liferay, storing document, tags, categories etc in Liferay
integration with other systems
cluster

I would like to use CDI, bean pooling in transaction safe way.

Thank you for your feedback and time