-->
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.  [ 2 posts ] 
Author Message
 Post subject: Invalid postgres sql generated
PostPosted: Mon Jun 11, 2007 12:21 pm 
Newbie

Joined: Wed May 16, 2007 7:17 am
Posts: 7
Hi,

I am using NHibernate 1.2.0GA and have come up against this problem with the generated sql:

NpgsqlException - ERROR: 42601: syntax error at or near "x0_"

Code:
SELECT
45x0_.bugid as bugid__1_,
45x0_.personresourceid as personre2_1_,
resource1_.id as id24_0_,
resource1_.name as name24_0_,
resource1_.description as descript3_24_0_,
resource1_.displayname as displayn4_24_0_
FROM bugs.bugs_col_45_resources 45x0_
left outer join shared.resources resource1_ on 45x0_.personresourceid=resource1_.id
WHERE 45x0_.bugid=276


This is because 45x0_ is an invalid alias name.

Is there any way to change how NHibernate will generate this sql so that it will be valid?

Many thanks,
Chris


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 12, 2007 4:15 am 
Newbie

Joined: Wed May 16, 2007 7:17 am
Posts: 7
Ok - I have solved this, posting here incase it helps anyone else.

My mapping looked like:

Code:
<dynamic-component>
  <set name="45">
    ...


So I changed this to:

Code:
<dynamic-component>
  <set name="col_45">
    ...


Maybe NHibernate should check that the name it chooses as an alias begins with a valid character, and then prepends an '_' or similar if the alias name is invalid?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.