Hello everybody.
I am using Service Builder with Liferay 5.2.5 (ee). In my database schema I have some foreign keys which may also be not set. So instead of using the "long"-type for these attributes, I am using the type "Long", so also null-values can be represented.
The generated source is compliled correctly and the war-file is deployed without any errors. When I try to read or write such an object the following exception occurs:
1com.liferay.portal.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: Unknown entity: de.myapp.invoicing.model.impl.InvoicingUserExtImpl
2 at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:97)
3 at de.myapp.invoicing.service.persistence.InvoicingUserExtPersistenceImpl.fetchByPrimaryKey(InvoicingUserExtPersistenceImpl.java:287)
4 ...
5Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: Unknown entity: de.myapp.invoicing.model.impl.InvoicingUserExtImpl
6 at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:41)
7 at com.liferay.portal.dao.orm.hibernate.SessionImpl.get(SessionImpl.java:131)
8 at de.myapp.invoicing.service.persistence.InvoicingUserExtPersistenceImpl.fetchByPrimaryKey(InvoicingUserExtPersistenceImpl.java:283)
9 ... 200 more
10Caused by: org.hibernate.MappingException: Unknown entity: de.myapp.invoicing.model.impl.InvoicingUserExtImpl
11 at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
12 at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)
13 at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
14 at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
15 at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
16 at com.liferay.portal.dao.orm.hibernate.LiferaySession.get(LiferaySession.java:181)
17 at com.liferay.portal.dao.orm.hibernate.SessionImpl.get(SessionImpl.java:128)
18 ... 201 more
After some research I noticed that the problem seems to be the generated hibernate-mapping. For the "Long"-attributes, entries are created like this:
1<property name="someForeignKey" />
There is no type defined in this tag. Although hibernate seems to allow not explicitly defining the type in general, this seems to be the problem. When I replace this line by
1<property name="someForeignKey" type="java.lang.Long" />
everything is working fine. A closer look at service-builder's template file for the hibernate mapping told me that the type is only written into the mapping file for primitive types and String. Does anybody know why?
Does anybody have the same problem like me? Or am I the only one who's using the Long-type?
Is this behavior a bug or a feature?

Thanks in advance and wishes from Germany,
Patrick
Be kell jelentkezni ahhoz, hogy ez helytelenként legyen megjelölve.