You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Krzysztof <ya...@gmail.com> on 2012/03/30 13:15:20 UTC

Adding another abstract class to the inheritance chain breaks callbacks parsing

Hello,
Is it a normal situation:
After turning a concrete class that inherits from an abstract (persistent as
well) class into an abstract class, openjpa 2.1.1 bootstrapping fails with
the error below.
Is it an expected behaviour? 

Thanks for any hints,
Krzysztof
...
Caused by: <openjpa-2.1.1-r422266:1148538 fatal user error>
org.apache.openjpa.persistence.ArgumentException: Could not invoke the
static newInstance method on the named factory class
"org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory".
	at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:76)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:151)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:95)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:157)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:66)
	at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:152)
	... 18 more
Caused by: <openjpa-2.1.1-r422266:1148538 fatal general error>
org.apache.openjpa.persistence.PersistenceException: Could add the following
callback adapters to "gaia.cu7.om.output.VariResultRoot", as the lifecycle
metadata is already resolved:
[org.apache.openjpa.event.MethodLifecycleCallbacks:private void
gaia.cu7.om.output.VariResultRoot.UpdateState()]
	at
org.apache.openjpa.meta.LifecycleMetaData.setDeclaredCallbacks(LifecycleMetaData.java:120)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.recordCallbacks(AnnotationPersistenceMetaDataParser.java:1012)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:675)
	at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:415)
	at
org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260)
	at
org.apache.openjpa.meta.MetaDataRepository.preload(MetaDataRepository.java:344)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.postCreationCallback(AbstractBrokerFactory.java:868)
	at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.postCreationCallback(JDBCBrokerFactory.java:105)
	at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:67)
	... 23 more



--
View this message in context: http://openjpa.208410.n2.nabble.com/Adding-another-abstract-class-to-the-inheritance-chain-breaks-callbacks-parsing-tp7421075p7421075.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: Adding another abstract class to the inheritance chain breaks callbacks parsing

Posted by Krzysztof <ya...@gmail.com>.
I found the solution: if the type was defined in the orm.xml (even without
any callbacks specified there) - callback from the code were not called.
Solution is either to remove the class from orm.xml or move the callbacks
there.

---
Krzysztof

--
View this message in context: http://openjpa.208410.n2.nabble.com/Adding-another-abstract-class-to-the-inheritance-chain-breaks-callbacks-parsing-tp7421075p7491984.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: Adding another abstract class to the inheritance chain breaks callbacks parsing

Posted by Krzysztof <ya...@gmail.com>.
Thanks for the hint, but yes: all abstract classes in the inheritance chain
have 
@MappedSuperclass 
and 
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

Also the concrete class at the end has the 
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)

Changing @Entity to @MappedSuperclass of the abstract class does not help
unfortunately.

--
View this message in context: http://openjpa.208410.n2.nabble.com/Adding-another-abstract-class-to-the-inheritance-chain-breaks-callbacks-parsing-tp7421075p7421370.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

AW: Adding another abstract class to the inheritance chain breaks callbacks parsing

Posted by Boblitz John <Jo...@BERTSCHI.com>.
> -----Ursprüngliche Nachricht-----
> Von: Krzysztof [mailto:yazuna@gmail.com] 
> Gesendet: Freitag, 30. März 2012 13:15
> An: users@openjpa.apache.org
> Betreff: Adding another abstract class to the inheritance 
> chain breaks callbacks parsing
> 
> Hello,
> Is it a normal situation:
> After turning a concrete class that inherits from an abstract 
> (persistent as
> well) class into an abstract class, openjpa 2.1.1 
> bootstrapping fails with the error below.
> Is it an expected behaviour? 
> 
> Thanks for any hints,
> Krzysztof
> ...
> Caused by: <openjpa-2.1.1-r422266:1148538 fatal user error>
> org.apache.openjpa.persistence.ArgumentException: Could not 
> invoke the static newInstance method on the named factory 
> class "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory".
> 	at 
> org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap
> .java:76)
> 	at
> org.apache.openjpa.persistence.PersistenceProviderImpl.getBrok
> erFactory(PersistenceProviderImpl.java:151)
> 	at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createE
> ntityManagerFactory(PersistenceProviderImpl.java:95)
> 	at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createE
> ntityManagerFactory(PersistenceProviderImpl.java:157)
> 	at
> org.apache.openjpa.persistence.PersistenceProviderImpl.createE
> ntityManagerFactory(PersistenceProviderImpl.java:66)
> 	at
> javax.persistence.Persistence.createEntityManagerFactory(Persi
> stence.java:152)
> 	... 18 more
> Caused by: <openjpa-2.1.1-r422266:1148538 fatal general error>
> org.apache.openjpa.persistence.PersistenceException: Could 
> add the following callback adapters to 
> "gaia.cu7.om.output.VariResultRoot", as the lifecycle 
> metadata is already resolved:
> [org.apache.openjpa.event.MethodLifecycleCallbacks:private 
> void gaia.cu7.om.output.VariResultRoot.UpdateState()]
> 	at
> org.apache.openjpa.meta.LifecycleMetaData.setDeclaredCallbacks
> (LifecycleMetaData.java:120)
> 	at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataPa
> rser.recordCallbacks(AnnotationPersistenceMetaDataParser.java:1012)
> 	at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataPa
> rser.parseClassAnnotations(AnnotationPersistenceMetaDataParser
> .java:675)
> 	at
> org.apache.openjpa.persistence.AnnotationPersistenceMetaDataPa
> rser.parse(AnnotationPersistenceMetaDataParser.java:415)
> 	at
> org.apache.openjpa.persistence.PersistenceMetaDataFactory.load
> (PersistenceMetaDataFactory.java:260)
> 	at
> org.apache.openjpa.meta.MetaDataRepository.preload(MetaDataRep
> ository.java:344)
> 	at
> org.apache.openjpa.kernel.AbstractBrokerFactory.postCreationCa
> llback(AbstractBrokerFactory.java:868)
> 	at
> org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.postCreationC
> allback(JDBCBrokerFactory.java:105)
> 	at 
> org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap
> .java:67)
> 	... 23 more
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Adding-another-abstract-cl
> ass-to-the-inheritance-chain-breaks-callbacks-parsing-tp742107
> 5p7421075.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 

Did you include @Inheritance / @Mapped annotations in the "new" AbstractClass?

 

John

---- 

Who is General Failure, and why is he reading my hard disk?