james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim-Christian Mundt <...@tim-erwin.de>
Subject Re: [IMAP] Cut a milestone ?
Date Thu, 10 Jun 2010 21:18:21 GMT
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.

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.

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.

Tim


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


Mime
View raw message