Hi Tim, comments inside..
2010/6/10 Tim-Christian Mundt <[email protected]>: > Hi, > > Am Donnerstag, den 10.06.2010, 19:56 +0200 schrieb Norman Maurer: >> After thinking a bit more about it, could it be that the two tables >> are used for mapping ? I think that would make sense because we have a >> many relation here.. >> >> So one for mapping Message and Properties and one for Message and Header. > That's true. However, we don't have Many-to-many mappings here, but one > to many (as defined in AbstractJPAMessage). So these tables are > basically superfluous and causing (little) performance loss. The reason > they are created by OpenJPA is that the mappings are unidirectional. You are right.. One-to-Many should not need the "join table". > > Although we don't need a "message" field in Headers and Properties I > think we should introduce it and thus allow for One-To-Many without > mapping table. I already tried doing that, adding @JoinColum and > "mappedBy" according to the specification: > http://java.sun.com/javaee/5/docs/api/javax/persistence/OneToMany.html > > However, when mappedBy="message" is added to the AbstractJPAMessage then > OpenJPA hangs without any error output (despite <property > name="openjpa.Log" value="SQL=TRACE"/>) and the tables won't get > created. If put into JPAMessage (overriding the field) the tables get > created as usual simply with the addition of a join column (in Header). > I guess it has to do with the inheritance. Any idea? Otherwise I'd ask > on some OpenJPA mailing list. Askin on the OpenJPA mailing list would be a good idea.. > > Besides that there is a proprietary solution for OpenJPA: > �...@onetomany(cascade = CascadeType.ALL, fetch=FetchType.LAZY) > �...@elementjoincolumn(name="message_id", referencedColumnName="id") > private List<JPAHeader> headers; > > This fixes the issue but is non-standard. Other framworks like jpox also > have such options if I don't err. If nothing helps we could move the mapping stuff to the OpenJPA* classes, but I think it should be possible with using plain "JPA". > > Tim > Bye, Norman --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
