-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: @Any - Property has an unbound type
PostPosted: Tue Apr 08, 2014 9:15 am 
Newbie

Joined: Wed Mar 05, 2014 9:19 am
Posts: 7
Hi,

we are using @Any annotation in our project and we want to use Hibernate OGM. We are running on EAP 6.1.1 and it works OK, but when we add modules to the EAP generated by OGM with https://github.com/hibernate/hibernate-ogm/pull/307 and add PU into persitence.xml we are getting an exception. I think it is because of some change between Hibernate 4.2.0 and 4.3.1. Any idea why on pure EAP it works but with the OGM modules doesn't?

Code:
Code:
@Entity
public class Report<T> implements Serializable {

    @Any(metaColumn = @Column(name = "target_type"))
    @AnyMetaDef(idType = "long", metaType = "string",
            metaValues = {
                    @MetaValue(targetEntity = Project.class, value = "P"),
                    @MetaValue(targetEntity = Release.class, value = "R"),
                    @MetaValue(targetEntity = Artifact.class, value = "A")
            })
    @JoinColumn(name = "target_id")
    private T target;

    ...
Stacktrace:
Code:
14:16:43,864 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC000001: Failed to start service jboss.persistenceunit."build-tracker.ear/build-tracker-backend.jar#relationdbPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."build-tracker.ear/build-tracker-backend.jar#relationdbPU": javax.persistence.PersistenceException: [PersistenceUnit: relationdbPU] Unable to build EntityManagerFactory
   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
   at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
   at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final-redhat-1.jar:2.1.0.Final-redhat-1]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: relationdbPU] Unable to build EntityManagerFactory
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:930)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:92)
   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
   at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
   ... 4 more
Caused by: org.hibernate.AnnotationException: Property org.jboss.buildtracker.database.dao.model.Report.target has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
   at org.hibernate.cfg.PropertyContainer.assertTypesAreResolvable(PropertyContainer.java:140)
   at org.hibernate.cfg.PropertyContainer.getProperties(PropertyContainer.java:118)
   at org.hibernate.cfg.AnnotationBinder.addElementsOfClass(AnnotationBinder.java:1356)
   at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:236)
   at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:665)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3468)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3422)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1349)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1749)
   at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920)
   ... 9 more


Top
 Profile  
 
 Post subject: Re: @Any - Property has an unbound type
PostPosted: Tue Apr 08, 2014 11:35 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
that's probably the case, I need to check this but I suspect that they added a validation that was missing before. Is it possible that your application is using a type that is not declared in the metaValues?


Top
 Profile  
 
 Post subject: Re: @Any - Property has an unbound type
PostPosted: Wed Apr 09, 2014 6:17 am 
Newbie

Joined: Wed Mar 05, 2014 9:19 am
Posts: 7
For this Report entity we are using only the specified classes as target.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.