-->
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: Problem with porting to MsSQL.
PostPosted: Thu Jan 25, 2007 10:37 am 
Newbie

Joined: Thu Jan 25, 2007 10:13 am
Posts: 5
Hi!

I have a fully working applications that runs on MySQL5. But now a new client demands MsSQL as database.

I run Hibernate 3.
MSSQL jdbc driver is jTds-1.2

the HQL query looks like this(working under MySQL)
Code:
Query query = session().createQuery("from User as user where user.name = :name");
        query.setString("name",name);


Here is the stack trace..
Code:
2007-01-25 15:10:01,180 WARN  [org.hibernate.util.JDBCExceptionReporter] Preparing the statement failed: Incorrect syntax near the keyword 'User'.
2007-01-25 15:10:01,180 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2007-01-25 15:10:01,196 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Client,strin
=java.lang.RuntimeException: org.hibernate.exception.GenericJDBCException: could not execute query using iterate,actor=null,detail=null]
2007-01-25 15:10:01,196 ERROR [org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper] SOAP request exception
java.lang.RuntimeException: org.hibernate.exception.GenericJDBCException: could not execute query using iterate
        at com.icr3.dao.UserDAO.getUserByName(UserDAO.java:112)
        at com.icr3.dao.UserDAO.verifyUser(UserDAO.java:120)
        at com.icr3.al.ICRUserManager.verifyUser(ICRUserManager.java:167)
        at com.icr3.al.ICRWSManager.verifyUser(ICRWSManager.java:797)
        at com.icr3.webservice.WSICR.verifyUser(WSICR.java:337)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.jboss.ws.server.ServiceEndpointInvokerJSE.invokeServiceEndpoint(ServiceEndpointInvokerJSE.java:91)
        at org.jboss.ws.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:151)
        at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:195)
        at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:373)
        at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:116)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:77)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)




I have also tried to querying using native SQL-syntax and then I a get an exception saying -

"SQL queries do not currently support iteration"

It sound like some cursor problem.. But I havenĀ“t found something.

Help is needed.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 10:52 am 
Newbie

Joined: Thu Jan 25, 2007 10:13 am
Posts: 5
did forget to post the mapping

Code:
<hibernate-mapping>
  <class name="com.icr3.model.User">
    <id name="id" type="long" column="id">
      <generator class="native"/>
    </id>
    <property name="name"/>
    <property name="password"/>
    <property name="privilege"/>
    <!-- A user belongs to a unit, and a unit may have many user -->
    <many-to-one name="unit" column="unitId"  cascade="all" />
  </class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 2:45 am 
Newbie

Joined: Thu Jan 25, 2007 10:13 am
Posts: 5
Problem solved!

I discovered that the name "User" that was used as a table name is a reserved keyword in MS SQL-Server.


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.