I have been fiddling with ormlite on android. It’s early days and so far I really like what I have seen.
While reading the manual I noticed the ability to use javax.persistence annotation instead of the default. When trying to define a @ManyToOne relationship I cam a little unstuck. Normally I use a @JoinColumn(name="xxx") to defined the column name with a @ManyToOne, ie. not the @Column(name="xxx"). Am I right, or should I be looking at this a different way.
I had a quick look and thought a few small additions to com.j256.ormlite.misc.JavaxPersistence.java would resolve this issue. Basically the duplicating the code to handle the @Column to instead handle the @JoinColumn (maybe without the “length”).
This also left me wondering is there were any issues with using both the standard ormlite annotations as well as the javax.persistence ones. Questions like:
- do the standard annotations take precedence?, and
- can the processing of
javax.persistenceannotations be disabled?
Unfortunately @user928550, the
javax.persistenceannotations are not completely supported by ORMLite. The limited support for them is defined in the manual:I’d be happy to improve the support for them if you want to make suggestions about how to proceed. Please use the ORMLite developers mailing list to suggest your additions:
In answer to you specific questions, existence of the
@DatabaseFieldannotation will override anyjavax.persistenceannotation processing and you cannot disable the processing ofjavax.persistence(unless you specify a@DatabaseField).