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.
精彩评论