开发者

Using Hibernate .hbm in addition to annotations

开发者 https://www.devze.com 2023-03-26 22:08 出处:网络
I have a bunch of autogenerated files that look similar to the following one: @XmlAccessorType(XmlAccessType.FIELD)

I have a bunch of autogenerated files that look similar to the following one:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FooType", propOrder = {
    "bar",
    "foobar"
})
@Entity(name = "FooType")
@Table(name = "FOOTYPE")
@Inheritance(strat开发者_StackOverflow中文版egy = InheritanceType.JOINED)
public class FooType
    implements Serializable, Equals, HashCode {
   // more stuff
}

These files are generated from a XML-Schema. What I need to do is adding caching capabilities to these classes. While there are various ways to add annotations to it, I'm required to use mapping files (.hbm.xml).

I've read somewhere that you can use .hbm.xml and annotations side by side, but when I've tried adding an hbm file like this one:

I got an org.hibernate.DuplicateMappingException. So, is it actually possible? What did I do wrong?


If you want all annotations to be ignorred then don't use AnnotationConfiguration or AnnotationSessionFactoryBean. Use Configuration or LocalSessionFactoryBean instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消