Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ay Kay
Vaadin and Service Builder
February 3, 2013 6:52 AM
Answer

Ay Kay

Rank: Junior Member

Posts: 52

Join Date: November 17, 2011

Recent Posts

Hi there.

Does anyone know (or can supply reference on) how to get hold of Service Builder classes from within Vaadin?

Here is one of my many failing attempts.

1        List<User> clients = UserLocalServiceUtil.getOrganizationUsers(chamberId);
2
3        for (User client : clients)
4        {
5            try
6            {
7                MyEntityPersistence MyEntityPersistence = MyEntityUtil.getPersistence();
8                List<MyEntity> myEntities = MyEntityPersistence.findByClientId(client.getUserId());

Since UserLocalServiceUtil works without problems I expected
  • MyEntityUtil
  • MyEntityLocalServiceImpl
  • MyEntityPersistenceImpl
which reside in my Vaadin portlet project to be just as accessable. They aren't!

Caused by: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

in line 8 of code above. So Hibernate Session is not bound to this thread. Seems I don't have the appropriate objects (instances) at all. Which brings me to my question: How to get hold of them?

Thank you! And have a nice weekend.
Cheers.


PS: Sorry for displaying such an amount of ignorance. INet couldn't help me here so far.
David H Nebinger
RE: Vaadin and Service Builder
February 3, 2013 7:43 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6704

Join Date: September 1, 2006

Recent Posts

Yep, we do this all the time...

Basically in MyEntityLocalServiceImpl, add the method List<MyEntity> findByClientId(long userId) method. This method implementation, since it is part of the plugin providing the service it won't encounter class cast issues.

Upon re-running service builder, the MyEntityLocalServiceUtil class will now have a findByClientId() method that you can use in your Vaadin layer to access the information.
Ay Kay
RE: Vaadin and Service Builder
February 3, 2013 11:38 AM
Answer

Ay Kay

Rank: Junior Member

Posts: 52

Join Date: November 17, 2011

Recent Posts

Thanks David.

This and your explanation in the other thread cleared it for me. Thank you for taking some time of your precious weekend.

Cheers


PS: If someone else should ever run into this, after a quick note here, I'll add my lines. It's very basic. You just need to know about the process.