james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Charles <e...@apache.org>
Subject OpenJPA usage at Apache James
Date Mon, 21 Jun 2010 18:46:08 GMT

Apache James project uses OpenJPA 2.0.

We've got @OneToMany relations on AbstractJPAMessage [1] to JPAHeader 
[2] (headers attribute) and JPAProperty [3] (properties attribute).
With current config, intermediary tables are created (MESSAGE_HEADER and 
MESSAGE_PROPERTY) but we would like to get rid of these.

a) We tried to use the @OneToMany 'mappedBy' attribute, adding a 
JPAMessage attribute on the JPAHeader and JPAProperty.
The tables are correctly created if we redefine the annotated headers 
and properties attributes on the concrete JPAMessage [4] class.
We had however to define openjpa.InverseManager=true to make it work at 

b) When we set the @OneToMany with 'mappedBy' attribute on the 
AbstractJPAMessage (and the JPAMessage on the JPAHeader and 
JPAProperty), the tables are created, but not the FK. At runtime, the 
application generates SQL, but no response seems to come back (no 
exception in the log). It simply hangs.

c) In a) and b) scenario, we need to define an additional JPAMessage 
concrete attribute on JPAHeader and JPAProperty.
This does not allow to define FK to other types, such as the 
JPAStreamingMessage [5].
In this case, the class structure we built does not make much sense.
Would a Custom Mapping help? 

d) If we set @ElementJoinColumn(name="MESSAGE_ID", 
referencedColumnName="ID") on the headers and properties in the 
AbstractJPAMessage, everything works fine.
This also solve problem mentioned in c) because we don't need any 
JPAMessage attributed on JPAHeader and JPAProperty.
However, we try to stick to the standard JPA API without using OpenJPA 
extensions if not necessary.

e) Apart from the above points, are there any standard way to define 
indexes other than org.apache.openjpa.persistence.jdbc.Index ?

We would like to hear your comments on the above.
What do you think we should consider/investigate? Are our 
interpretations correct?



PS: Please reply-to-all so we can follow the thread on James ml.

[1] AbstractJPAMessage 
[2] JPAHeader 
[3] JPAProperty 
[4] JPAMessage 
[5] JPAStreamingMessage 

To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org

View raw message