You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Jonathan Feinberg <jd...@us.ibm.com> on 2007/04/18 20:56:00 UTC
Any way to index multiple columns?
Is there any way to cause the OpenJPA schema builder to emit an index across multiple columns? My attempt,
@Column(columnDefinition = "bytea")
@Index(name = "i_owner_md5", columnNames = { "owner_id, md5" })
public byte[] getMd5()
{
return md5;
}
is silently misinterpreted, in that only the annotated field (md5) gets indexed.
Thanks,
--
Re: Any way to index multiple columns?
Posted by Marc Prud'hommeaux <mp...@apache.org>.
Jonathan-
It looks like we indeed do ignore the columnNames field of the index.
This is a bug, and I've entered it at:
https://issues.apache.org/jira/browse/OPENJPA-223
I don't think there is a workaround, unless the index is unique, in
which case you can use the JPA standard
javax.persistence.UniqueConstraint annotation on the @Table
annotation (which allows you to specify multiple columns, and which
we appear to respect).
On Apr 18, 2007, at 11:56 AM, Jonathan Feinberg wrote:
> Is there any way to cause the OpenJPA schema builder to emit an
> index across multiple columns? My attempt,
> @Column(columnDefinition = "bytea")
> @Index(name = "i_owner_md5", columnNames = { "owner_id, md5" })
> public byte[] getMd5()
> {
> return md5;
> }
> is silently misinterpreted, in that only the annotated field (md5)
> gets indexed.
>
> Thanks,
> --