Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TENEO] using createSQLQuery
[TENEO] using createSQLQuery [message #612491] Tue, 13 November 2007 20:15
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
I have a teneo annotated ecore model and I have been able to
successfully make HQL queries such as:

session.createQuery("from GeneralCodeItem")

However, if I try to use a SQL query such as:

session.createSQLQuery("select value, description, short_description
from general_code_item").addEntity("GeneralCodeItem")

I get
64606777 [main] INFO org.hibernate.type.StringType - could not read
column value from result set: "VALUE"; Invalid column name

After debugging, I've determined the source of the problem in an
additional set of quotes. The result set has a column VALUE, but
hibernate is looking for "VALUE". When I look in the mapping file, I
see backticks in the column name which I presume is the source of the
extra quotes:

<id name="value" type="java.lang.String">
<column not-null="true" unique="false" name="`VALUE`"/>
</id>

All my column names have backticks. What is the reason for this and is
there anything I can do about it? I have the following workaround, but
it is very verbose and defeats the purpose of having the teneo mappings:

session.createSQLQuery("select {gc}.value {gc.value}, {gc}.description
{gc.description}, {gc}.short_description {gc.shortDescription} from
general_code_item {gc}").addEntity("gc", "GeneralCodeItem")

Thanks!
Will
Previous Topic:[CDO] need help with difficult problem
Next Topic:[CDO] server config file docs
Goto Forum:
  


Current Time: Fri Apr 26 11:18:42 GMT 2024

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

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

Back to the top