-->
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: Problem with Mappings
PostPosted: Tue Apr 18, 2006 10:22 am 
Newbie

Joined: Tue Apr 18, 2006 9:16 am
Posts: 1
I know it is little strange, but :

We have two classes:


Hibernate version: 3.1.2 , Annotation 3.1beta9

Code:

package com.icw.phr.record.domain;
@javax.persistence.Entity
@javax.persistence.Table(schema = "Record", name = DocumentReference")
public class DocumentReference extends AbstractDomainObject{...}


package com.icw.phr.workplace.domain;
@javax.persistence.Entity
@javax.persistence.Table(schema = "Workplace", name = DocumentReference")
public class DocumentReference extends AbstractDomainObject{...}


We put them in one Configuration, and when we try to build SessionFactory, we get this exception :

org.hibernate.AnnotationException: Use of the same entity name twice: DocumentReference
at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:204)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:474)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:295)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1168)

_________________
Rostislav


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 3:26 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
And?

Don't use the same name twice.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 9:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
use @Entity(name="DocumentReference2" in one of you classes. the name defaulted to the unqualified class name has to be unique across a persistence unit

_________________
Emmanuel


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.