-->
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.  [ 4 posts ] 
Author Message
 Post subject: MappedSuperclass: Duplicate property mapping
PostPosted: Thu Nov 13, 2008 5:15 am 
Newbie

Joined: Thu Mar 13, 2008 2:04 pm
Posts: 6
I am using annotations.
I have a base class, annotated with @MappedSuperclass, and an inheriting class, annotated with @Entity.

The inheriting class overrides a get-method of the super class, now Hibernate is saying: "org.hibernate.MappingException: Duplicate property mapping...".

Can anymore tell me how to resolve this?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2008 5:41 am 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
Do you annotate your class properties or getters? I prefer to annotate properties and leave getters unannotated personally as I think it looks more tidy. For example,

Code:
@Entity
public class MyClass {

    @Column(name = "something")
    private String something;

    public String getSomething() {
      return this.something;
    }

}



If you use this technique you will be able to override getters without worrying about hibernate errors.


Top
 Profile  
 
 Post subject: Good idea
PostPosted: Thu Nov 13, 2008 5:57 am 
Newbie

Joined: Thu Mar 13, 2008 2:04 pm
Posts: 6
Great tip, thank you!

For practical reasons though, I cannot use this solution.


Top
 Profile  
 
 Post subject: Re: MappedSuperclass: Duplicate property mapping
PostPosted: Tue Oct 16, 2012 10:54 am 
Newbie

Joined: Tue Oct 16, 2012 10:50 am
Posts: 1
I have the same problem but moving the annotation is't helping.
Is there a way for me to override getters without getting this error message?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.