openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marina Vatkina <Marina.Vatk...@Sun.COM>
Subject Re: OpenJPA problem wtih Sequence generator & many to one mapping samples required
Date Tue, 24 Apr 2007 20:36:03 GMT
There is nothing special that you need to do. Java EE 5 Tutorial has an example 
that uses TableGenerator, but it shouldn't matter much - see 
http://java.sun.com/javaee/5/docs/tutorial/doc/PersistenceEJB2.html#wp82561

-marina

saidulu chitipolu wrote:
> Hi,
>    
>   We are using openjpa-0.9.6-incubating,we have situation need to work with
>    
>   sequence-generator in orm file.
>    
>   facing the problem in persisting data using sequence generator. How to resolve this
without using a sequence generator in mapped-superclass.
>    
>     Exception in thread "main" org.springframework.transaction.CannotCreateTransactionException:
Could not open JPA EntityManager for transaction; nested exception is <4|true|0.9.6-incubating>
org.apache.openjpa.persistence.ArgumentException: Superclass field "java.lang.Object.id" is
mapped in the metadata for subclass "com.abc.xyz.mno.Header", but is not a persistent field.
>   Caused by: <4|true|0.9.6-incubating> org.apache.openjpa.persistence.ArgumentException:
Superclass field "java.lang.Object.id" is mapped in the metadata for subclass "com.abc.xyz.mno.Header",
but is not a persistent field.
>         at org.apache.openjpa.meta.ClassMetaData.getSuperclassField(ClassMetaData.java:894)
>         at org.apache.openjpa.meta.ClassMetaData.resolveDefinedSuperclassFields(ClassMetaData.java:1186)
>         at org.apache.openjpa.meta.ClassMetaData.defineSuperclassFields(ClassMetaData.java:1162)
>         at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:306)
>         at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:600)
>         at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:487)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:283)
>         at org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:271)
>         at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:660)
>         at org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:732)
>         at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:630)
>         at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:161)
>         at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:127)
>         at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:164)
>         at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:139)
>         at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:187)
>         at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:140)
>         at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:52)
>         at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:378)
>         at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:302)
>         at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:349)
>         at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:255)
>         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
>         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
>         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
>         at $Proxy15.save(Unknown Source)
>         at com.abc.xyz.xxx.repxxx.delegate.RepxxxxxDelegateImpl.schedule(RepxxxxxDelegateImpl.java:114)
>         at com.abc.xyz.xxx.repxxx.RepxxxxxxImpl.schedule(RepxxxxImpl.java:61)
>         at dao.execute.Repxxxxxxxx.main(Repxxxxxxx.java:200)
> 
>    
>    
>   Could you share any samples available for persisting data uses sequence-generator of
database and foreigkey constraint with may-to- one mapping.
>    
>   Thanks in advance for your help.
>    
>   Regards
>   Saidulu
> 
> 
> 
>        
> ---------------------------------
>  Check out what you're missing if you're not on Yahoo! Messenger 
> 

Mime
View raw message