-->
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: how to override property in order to change constraints
PostPosted: Thu Jul 27, 2006 6:02 am 
Newbie

Joined: Thu Mar 09, 2006 5:48 am
Posts: 10
Hibernate version:
Hibernate 3.2

suppose I have the following class
Code:
@MappedSuperclass
public abstract class Baseclass implements Serializable{

   private String name;
   
   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }


Code:
public class XXX extends Baseclass {

   @Override
   @Column(unique=true)
   public String getName() {
      return name;
   }

}



but after deploying I got the following error:

Quote:
ObjectName: persistence.units:ear=imagineManagment.ear,unitName=ImagineDB
State: FAILED
Reason: org.hibernate.MappingException: Duplicate property mapping of name found in ...



Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 2:20 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Don't make the superclass a @MAppedSuperclass or mark the superclass property as @TRansient

_________________
Emmanuel


Top
 Profile  
 
 Post subject: I solved it by AttributeOverride
PostPosted: Sun Jul 30, 2006 2:25 am 
Newbie

Joined: Thu Mar 09, 2006 5:48 am
Posts: 10
@AttributeOverride(name="name",column=@Column(unique=true))


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.