Foros de discusión

Vaadin and Service Builder

thumbnail
Ay Kay, modificado hace 11 años.

Vaadin and Service Builder

Junior Member Mensajes: 52 Fecha de incorporación: 17/11/11 Mensajes recientes
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.

		List<user> clients = UserLocalServiceUtil.getOrganizationUsers(chamberId);

		for (User client : clients)
		{
			try
			{
				MyEntityPersistence MyEntityPersistence = MyEntityUtil.getPersistence();
				List<myentity> myEntities = MyEntityPersistence.findByClientId(client.getUserId());
</myentity></user>

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.
thumbnail
David H Nebinger, modificado hace 11 años.

RE: Vaadin and Service Builder

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
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.
thumbnail
Ay Kay, modificado hace 11 años.

RE: Vaadin and Service Builder

Junior Member Mensajes: 52 Fecha de incorporación: 17/11/11 Mensajes recientes
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.