Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
2.1.8
Code between sessionFactory.openSession() and session.close():
A a= ATestHelper.create();
a.addDigitalProduct(digitalProduct);
Long cant= legConsService.count(qry);
I`m using Dao with HibernateTemplate for Spring, so the session is flush when i execute the query
Name and version of the database you are using:
oracle 9i
The generated SQL (show_sql=true):
don't generated anything, because fail before generated.
Hello everybody. I`m working with hibernate 2.1.8 and I`ve had a very strange problem.
I have the following relantionship:
A <---> B
It`s a many-to-many relationship, A have a collection of B.
I use xdoclet to build the hbm files... and it is for the class A the following:
/**
* @hibernate.set table="A_DIGITALPRODUCT" cascade="save-update" lazy="true"
* @hibernate.many-to-many column= "DIGITAL_PRODUCT_ID" class="B"
* @hibernate.key column="A_ID"
*/
public Collection getDigitalProducts() {
return digitalProducts;
}
private void setDigitalProducts(Collection ditalProducts) {
this.digitalProducts= digitalProducts;
}
when I execute a testcase, testing this mapping i have the following exception:
net.sf.hibernate.MappingException: Unknown entity class: java.lang.String
I`ve found a lot for this exception but is unusual to be throug with the java.lang.string. class
the stack trace:
net.sf.hibernate.MappingException: Unknown entity class: java.lang.String
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2718)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2725)
at net.sf.hibernate.impl.SessionImpl.getEntityIdentifierIfNotUnsaved(SessionImpl.java:2787)
at net.sf.hibernate.type.EntityType.getIdentifier(EntityType.java:67)
at net.sf.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:47)
at net.sf.hibernate.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:386)
at net.sf.hibernate.collection.Set.writeTo(Set.java:226)
at net.sf.hibernate.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:525)
at net.sf.hibernate.impl.ScheduledCollectionRecreate.execute(ScheduledCollectionRecreate.java:23)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2396)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1578)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at com.sae.arquitectura.dao.impl.HibernateQueryStatement.count(HibernateQueryStatement.java:123)
at com.sae.arquitectura.dao.impl.GenericDAOHibernate.count(GenericDAOHibernate.java:150)
at com.sae.service.impl.LegislacionConsolidadaServiceImpl.count(LegislacionConsolidadaServiceImpl.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:116)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
at $Proxy6.count(Unknown Source)
at com.laley.sae.controller.parsers.TestTraductorConsultaUsuarioLegislacionConsolidada.testProductoDigital(TestTraductorConsultaUsuarioLegislacionConsolidada.java:683)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
the same xdoclet and the same test is working very well with another attribute, called: CollectionSets.
need help people...thanks in advance.
an sorry for my english