-->
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.  [ 3 posts ] 
Author Message
 Post subject: ambiguous field error on Hibernate 3.5ß2
PostPosted: Tue Jan 26, 2010 11:28 am 
Newbie

Joined: Sun Jun 17, 2007 7:04 am
Posts: 11
Hello,
I am trying to deploy a JEE application working OK on JBoss 5 to Glassfish v3, which uses Hibernate 3.5ß2.
In my app I have a Form EJB with a relation to FormField EJBs. Both EJBs have a field named "date". I get:

Code:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'date' in field list is ambiguous


exception (as I said, I have no problem with JBoss 5 built in Hibernate).

Generated SQL:
Quote:
select form0_.id as id344_3_, form0_.confirmationText as confirma2_344_3_, date as date344_3_, form0_.description as descript4_344_3_, form0_.infomail as infomail344_3_, form0_.language as language344_3_, form0_.name as name344_3_, form0_.portal_id as portal9_344_3_, form0_.sibling_id as sibling10_344_3_, form0_.siteContactForm as siteCont8_344_3_, fields1_.form_id as form8_5_, fields1_.id as id5_, fields1_.id as id323_0_, fields1_.description as descript2_323_0_, fields1_.form_id as form8_323_0_, fields1_.formFile as formFile323_0_, fields1_.maxLength as maxLength323_0_, fields1_.name as name323_0_, fields1_.orderIndex as orderIndex323_0_, fields1_.required as required323_0_, portal2_.id as id316_1_, portal2_.description as descript2_316_1_, portal2_.homeurl as homeurl316_1_, portal2_.language as language316_1_, portal2_.lastAccessed as lastAcce5_316_1_, portal2_.name as name316_1_, portal2_.newUserNotification as newUserN7_316_1_, portal2_.requiresSignupConfirmation as requires8_316_1_, portal2_.sessionRememberDays as sessionR9_316_1_, portal2_.userSelfSignup as userSel10_316_1_, form3_.id as id344_2_, form3_.confirmationText as confirma2_344_2_, date as date344_2_, form3_.description as descript4_344_2_, form3_.infomail as infomail344_2_, form3_.language as language344_2_, form3_.name as name344_2_, form3_.portal_id as portal9_344_2_, form3_.sibling_id as sibling10_344_2_, form3_.siteContactForm as siteCont8_344_2_ from Form form0_ left outer join FormField fields1_ on form0_.id=fields1_.form_id inner join Portal portal2_ on form0_.portal_id=portal2_.id left outer join Form form3_ on form0_.sibling_id=form3_.id where form0_.id=2


This is generated SQL so I cannot easily modify it. Any ideas/help on how to solve this generated SQL problem?

Thanks,
Ignacio


Top
 Profile  
 
 Post subject: Re: ambiguous field error on Hibernate 3.5ß2
PostPosted: Wed Jan 27, 2010 6:46 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Given that the data-field is the unique one to miss the "form0_" prefix in the generated SQL,
I suppose that 'date' is kind of reserved keyword for hibernate.
I also know that 'date' is reserved keyword on certain databases as Oracle for example,
so it is always better to avoid such names for persistent fields.

Have you the possibility to rename the fields 'date' in something other ?
It probably would resolve your problem.


Top
 Profile  
 
 Post subject: Re: ambiguous field error on Hibernate 3.5ß2
PostPosted: Sun May 02, 2010 10:45 am 
Newbie

Joined: Tue Dec 18, 2007 7:42 am
Posts: 19
"date" was allowed in earlier 3.x versions, like 3.3.1.GA, but it doesn't seem to work for 3.5.1 :S


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

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.