1

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(strategy = 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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

The annotations are perfectly fine, what I want is some sort of "merging" the two configurations together.
In this case, I'd just put together my own extension of Configuration based on AnnotationConfiguration source code and put all logic there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.