openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Mak <h...@antennasoftware.com>
Subject OpenJPA querying on element collections
Date Mon, 26 Sep 2011 18:21:57 GMT
Hi,

Does anyone know if OpenJPA supports queries on element collections?

Given:
                @Entity
                @Table(name="items")
                public class Item implements Serializable {
                                @Id
                                @Column(name="seq_no")
                                private long m_seqNo;

                                @ElementCollection(fetch=FetchType.LAZY)
                                @CollectionTable(name="properties", joinColumns={ @JoinColumn(name="seq_no")
})
                                @MapKeyColumn(name = "prop_name")
                                @Column(name="prop_val")
                                private Map<String, String> m_properties;
                }
... basically, 1-to-many from "items" to "properties" with schema
                Table: items
                Column: seq_no               // primary key

                Table: properties
                Column: seq_no               // foreign key to "items"
                Column: prop_name      // m_properties keys
                Column: prop_val            // m_properties values

Then: running JPA query
                SELECT x FROM Item x WHERE x.m_properties.get('x') < 'h'
results in a parse exception for me on OpenJPA v2.0.0.
Thanks.

- Howard

This email and any files transmitted with it are confidential and intended solely for the
use of the individual or entity to whom they are addressed. Please note that any views or
opinions presented in this email are solely those of the author and do not necessarily represent
those of the company. Finally, the recipient should check this email and any attachments for
the presence of viruses. The company accepts no liability for any damage caused by any virus
transmitted by this email. If you have received this email in error please delete it and notify
the system administrator at administrator@antennasoftware.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message