Re: How to write it in JPQL

2007-01-10 Thread Marc Prud'hommeaux
That seems reasonable enough. Unfortunately, the JPQL query specification disallows anything but aggregate or state field expressions in "SELECT NEW" clauses. It might be useful as a future extension to OpenJPA, though. Can you file an enhancement request at http://issues.apache.org/jira/

Re: How to write it in JPQL

2007-01-10 Thread wanyna
There are two tables A and B, I need to execute sql like "insert into A select ... from B". I use JPQL Constructor Expressions, select new A(...) from B, got A list then persist. But some data of A depends on program context, not from B, for simple example: select new A(B.column1, 'xxx') from B,

Re: How to write it in JPQL

2007-01-10 Thread wanyna
There are two tables A and B, I need to execute sql like "insert into A select ... from B". I use JPQL Constructor Expressions, select new A(...) from B, got A list then persist. But some data of A depends on program context, not from B, for simple example: select new A(B.column1, 'xxx') from B,

Re: How to write it in JPQL

2007-01-10 Thread wanyna
There are two tables A and B, I need to execute sql like "insert into A select ... from B". I use JPQL Constructor Expressions, select new A(...) from B, got A list then persist. But some data of A depends on program context, not from B, for simple example: select new A(B.column1, 'xxx') from B,

Re: How to write it in JPQL

2007-01-10 Thread Marc Prud'hommeaux
On Jan 10, 2007, at 12:12 AM, wanyna wrote: Hi all. I have two questions: 1. Here is my sql string: select 'xxx', TABLE_A.column1 from TABLE_A; there is a string 'xxx' as a constant value, how to translate it to JPQL? I don't think it is possible. Why would you need to do that? 2. Another