You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Virag Kothari <vi...@yahoo-inc.com> on 2013/07/30 21:46:44 UTC
Error: Query projections cannot include array, collection, or map
fields
Hi All,
I am facing the following exception when having a blob (byte[]) as part of select statement.
Caused by: <openjpa-2.2.2-r422266:1468616 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Query projections cannot include array, collection, or map fields. Invalid query: "select a.lob1 from DummyBean a"
The following are the relevant parts of DummyBean:
@NamedQuery(name = "GET_LOB1", query = "select a.lob1 from DummyBean a"),
@Column(name = "lob1")
@Lob
private byte[] lob1 = null;
Is there a way to selectively retrieve just the byte[] (blob) columns? I know that "select OBJECT(a) from …" would work.
Without using JPA, I can prepare the statement using java.sql.Statement and retrieve using ResultSet.getByteArray(). What should I do to make it work with JPA?
Appreciate any help.
Thanks,
Virag
Re: Error: Query projections cannot include array, collection, or
map fields
Posted by Virag Kothari <vi...@yahoo-inc.com>.
Hi All,
Has no one seen this issue with JPA?
Thanks,
Virag
On 7/30/13 12:46 PM, "Virag Kothari" <vi...@yahoo-inc.com> wrote:
>Hi All,
>
>I am facing the following exception when having a blob (byte[]) as part
>of select statement.
>
>Caused by: <openjpa-2.2.2-r422266:1468616 nonfatal user error>
>org.apache.openjpa.persistence.ArgumentException: Query projections
>cannot include array, collection, or map fields. Invalid query: "select
>a.lob1 from DummyBean a"
>
>The following are the relevant parts of DummyBean:
>
>
>@NamedQuery(name = "GET_LOB1", query = "select a.lob1 from DummyBean a"),
>
>
> @Column(name = "lob1")
>
> @Lob
>
> private byte[] lob1 = null;
>
>
>
>Is there a way to selectively retrieve just the byte[] (blob) columns? I
>know that "select OBJECT(a) from Š" would work.
>
>Without using JPA, I can prepare the statement using java.sql.Statement
>and retrieve using ResultSet.getByteArray(). What should I do to make it
>work with JPA?
>
>
>Appreciate any help.
>
>
>Thanks,
>
>Virag
>
>
>
>
>
>
>