-->
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.  [ 4 posts ] 
Author Message
 Post subject: Error message when "@" character in table column
PostPosted: Tue Jan 18, 2005 5:38 pm 
Newbie

Joined: Tue Jan 18, 2005 5:20 pm
Posts: 3
Location: USA
Hi,

I am using Hibernate7c with SQL Server.

There are some columns in my table contain "@" characters at the beginning, like "@@upid", when I ran my application with SQL Server, it will threw me the error message "Syntax error", and I also tested it on AS400, it worked fine. I tried to write "select @@uipd from mytable" on SQL Server, it didn't work, but if I put double quote around "@@upid", everything seems okay. Then I think maybe because Hibernate doesn't put quote around columns, that's why the error occurred, I might wrong. So, did anyone have this kind of same problem before? Or know how to solve it?

Thanks so much!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 18, 2005 5:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use backticks in the mapping file around your column name


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 18, 2005 5:56 pm 
Newbie

Joined: Tue Jan 18, 2005 5:20 pm
Posts: 3
Location: USA
Here is the hbm.xml file:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="com.dao.Security" table="security">
       <composite-id name="id" class="com.dao.SecurityKey">
          <key-property name="user" column="user"/>
          <key-property name="attorney" column="att"/>
       </composite-id>
       <property name="upid" column="@@upid"/>
    </class>
</hibernate-mapping>



Security security = (Security) Session.get(Security.class, new SecurityKey("user", "att"));


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 18, 2005 5:58 pm 
Newbie

Joined: Tue Jan 18, 2005 5:20 pm
Posts: 3
Location: USA
Thanks michael for the reply, I will try it.


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