These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Column name conflict in generated SQL
PostPosted: Wed Apr 09, 2008 5:54 am 
Newbie

Joined: Wed Apr 09, 2008 5:36 am
Posts: 1
Hi,

I'm running Hibernate core 3.2.6 GA and Annotations 3.3.1 GA.

I have an HQL clause as follows:

em.createQuery("DELETE FROM DnsRecord r WHERE r.domain.name = ? AND r.name = ? " );

where DnsRecord contains a field named "domain" to an entity called DnsDomain. Both entities have a column called "name" in the database.

When executing the query, an exception gets thrown and the log shows:

****
Hibernate: delete from records, domains dnsdomain1_ where name=? and name=?|#]

[#|2008-04-09T12:21:40.375+0300|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=52;_ThreadName=p: thread-pool-1; w: 27;|
- SQL Error: 1064, SQLState: 42000
|#]
****

It seems that for some reason the table aliases are not used in the generated SQL and therefore the column names are ambiguous.

I'm using MySQL5 as the database backend.

Thanks,

-mjobanx


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.