Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » SQL to JPA
SQL to JPA [message #735185] Tue, 11 October 2011 03:37 Go to next message
Eclipse UserFriend
Hi.
In my database I have a table with 3 fields: field_1, field_2, field_3 and generated entity for that table. I need to implement something like this in EclipseLink:

Select (field_1/field_3) as field_1, (field_2/field_3) as field_2, field_3 from table;

Of course this is simplified example. Is there any way to do this without NativeQuery?


thanks for any help
Re: SQL to JPA [message #735396 is a reply to message #735185] Tue, 11 October 2011 11:40 Go to previous message
Eclipse UserFriend
This should work in JPQL, did you try it? You will get back an Object[] of the three values.

Select (t.field_1/t.field_3), (t.field_2/t.field_3), t.field_3 from Table t
--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Previous Topic:Eclipselink JPA merge problem
Next Topic:SQL to JPA
Goto Forum:
  


Current Time: Wed Jul 23 03:04:44 EDT 2025

Powered by FUDForum. Page generated in 0.49322 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top