Fórum

Vaadin and Service Builder

thumbnail
Ay Kay, modificado 11 Anos atrás.

Vaadin and Service Builder

Junior Member Postagens: 52 Data de Entrada: 17/11/11 Postagens Recentes
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 11 Anos atrás.

RE: Vaadin and Service Builder

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
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 11 Anos atrás.

RE: Vaadin and Service Builder

Junior Member Postagens: 52 Data de Entrada: 17/11/11 Postagens Recentes
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.