For the first few iterations of development, I was using a JPA Eclipse
plugin to generation my entities from their corresponding tables -
this all worked fine, but now I need to implement a reproducible
process for a build script, so I thought it wold be appropriate to
ReverseMappingTool, and it comes close, but not quite close enough to
generating usable entity classes. I only have three tables - master,
detail and link table for many-to-many relationship.
The JPA Eclipse plugin properly figures out the many-to-many
relationship and generates the appropriate annotations:
e.g. @ManyToMany(mappedBy="mdBaseData"...)
and @JoinTable(name="..", joinColumns={@JoinColumn(name="id2",
nullable=false)}, inverseJoinColumns={@JoinColumn(name="id1",
nullable=false)})
The ReverseMappingTool is not producing these annotations.
Here is how I am invoking it:
java -cp $CP org.apache.openjpa.jdbc.meta.ReverseMappingTool -p
persistence.xml#marketdata \
-cf.tabSpaces 4 -cf.spaceBeforeParen t -pkg poc.demo.entities \
-gc t -ann t -sn f -pkj t -ir t -access property -typ
NUMBER=java.math.BigDecimal \
-d ./../../main/java -cp mapping.properties \
-schemas POC.MD_BASE_DATA,POC.MD_CURVE_DATA,POC.MD_BASE_DATA_CURVE_DATA
mapping.properties contains:
poc.demo.entities.MdCurveData.identity: datastore
poc.demo.entities.MdBaseData.mdCurveData: java.util.Collection
I am deleting all entities and orm.xml between runs.
In addition to having ReverseMappingTool create the relationship
annotations, I'd like to know how to tell it to decorate certain date
columns with:
@Temporal( TemporalType.DATE)
Of course, I already read:
http://openjpa.apache.org/builds/2.2.1/apache-openjpa/docs/manual.html#ref_guide_pc_reverse
If anyone could help, that would be great.
Thanks,
-Chris