-->
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.  [ 9 posts ] 
Author Message
 Post subject: upgrade from 2.1.2 to 2.1.3 breaks
PostPosted: Sun May 02, 2004 8:24 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
We're using Hibernate in our gridsphere portlet based portal www.gridsphere.org which uses Tomcat 4. Using 2.1.2 works fine, but when I upgraded to 2.1.3 it fails with the following:

32412 [http8080-Processor4] (BatcherImpl.java:241) DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement32418 [http8080-Processor4] (JDBCExceptionReporter.java:36) DEBUG net.sf.hibernate.util.JDBCExceptionReporter - SQL Exceptionjava.sql.SQLException: Column not found: USER in statement [select user as x0_0_ from sportletuserimpl sportletus0_ where (sportletus0_.userid='root' )] at org.hsqldb.Trace.getError(Unknown Source) at org.hsqldb.jdbcResultSet.<init>(Unknown Source) at org.hsqldb.jdbcConnection.executeStandalone(Unknown Source) at org.hsqldb.jdbcConnection.execute(Unknown Source) at org.hsql

We used schemaexport tool to create database (uses HsqlDB) and I see:

CREATE TABLE SPORTLETUSERIMPL(GSOID VARCHAR(32) NOT NULL PRIMARY KEY,USERID VA
RCHAR(255),FAMILYNAME VARCHAR(255),FULLNAME VARCHAR(255),GIVENNAME VARCHAR(255
),EMAILADDRESS VARCHAR(255),ORGANIZATION VARCHAR(255),LASTLOGINTIME BIGINT)
...
INSERT INTO SPORTLETUSERIMPL VALUES('8ac38b9efc4591c700fc4591f32c0006','root',
'User','Root User','Root','root@localhost.localdomain','GridSphere',0)

the mapping document looks like:

[fuzzmonkey:~/gridsphere] novotny% more webapps/gridsphere/WEB-INF/persistence/SportletUserImpl.hbm.xml
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 1.1//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="org.gridlab.gridsphere.portlet.impl.SportletUserImpl"
table="sportletuserimpl"
>

<id
name="oid"
column="gsoid"
type="java.lang.String"
length="32"
>
<generator class="uuid.hex"/>

</id>

<property name="UserID" type="string" column="userid"/>
<property name="FamilyName" type="string" column="familyname"/>
<property name="FullName" type="string" column="fullname"/>
<property name="GivenName" type="string" column="givenname"/>
<property name="EmailAddress" type="string" column="emailaddress"/>
<property name="Organization" type="string" column="organization"/>
<property name="LastLoginTime" column="lastlogintime"/>
<map name="attributes" table="sportletuserattributes">
<key column="gsoid"/>
<index column="attribute" type="string"/>
<element column="value" type="string"/>
</map>

</class>


</hibernate-mapping>

any help is greatly appreciated

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 02, 2004 8:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Where exactly does it fail? Are you using a query like "select user from User user" or seomthing like that? If yes, try to change the alias used to something like "select uzer from User uzer".


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 02, 2004 12:56 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
hi Michael, where can we find all protected words for queries (user), mapping file, pojo properties (id??? never know if we can use it or not)?

Thanks,
Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 02, 2004 2:55 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
For the queries, IMHO it is best to not use words that are/might be protected words for the underlying database. The current behaviour about user in this example is however more a hibernate problem, the alias should really hide the SQL function, this will hopefully be fixed soon.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 6:30 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Thanks, Michael

I was in fact doing something "select user from User user" and changed that. Now I get another problem:

java.sql.SQLException: Column not found: USERID in statement [select sportletus0_.gsoid as gsoid, sportletus0_.userid as userid, sportletus0_.familyname as familyname, sportletus0_.fullname as fullname, sportletus0_.givenname as givenname, sportletus0_.emailaddress as emailadd6_, sportletus0_.organization as organiza7_, sportletus0_.lastlogintime as lastlogi8_ from sportletuserimpl sportletus0_ where (user.UserID='root' )]
at org.hsqldb.Trace.getError(Unknown Source)
at org.hsqldb.jdbcResultSet.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.executeStandalone(Unknown Source)


Is USERID also reserved or something? Anyway, what I don't understand is that it all works fine under 2.1.2, so were a whole bunch of new keywords introduced in the last version? I should proabbly wait then for this mess to get cleaned up, since I don't want to have to refactor so much of my code...
but for the record, what are all the reserved keywords in hibernate? We've tried hard to eliminate reserved keywords in various SQL vendors e..g making oid gs_oid since oid is also reserved in Oracle, etc.

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 6:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Basically what was changed is that now more sql functions are recognized in the select claus (user is a zero-argument function in hsqldb). What is probably bad is that aliases don't override the functions, so when you use "user" in the select clause and as an alias, Hibernate thinks it is a sql function. So we will have to change this.

For your second problem, please show the originating query, can't help you otherwise.


Top
 Profile  
 
 Post subject: Tomcat 5 + hibernate not working
PostPosted: Mon May 03, 2004 11:20 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
ok, thanks for your response. It turns out I was doing something dumb ;-) so now it all works at least with Tomcat 4.

Now, however, I'm seeing that "select uzer from SportletUser uzer" is not working with Tomcat 5. For some strange reason, it all works with Tomcat 4 but using Tomcat 5 it does not-- my stack trace seems to indicate the problem is in HttpServlet on Tomcat 5 code. Do you have any ideas?

at org.gridlab.gridsphere.core.persistence.hibernate.DatabaseTask.checkDBSetup(DatabaseTask.java:138)
at org.gridlab.gridsphere.portletcontainer.GridSphereServlet.processRequest(GridSphereServlet.java:131)
at org.gridlab.gridsphere.portletcontainer.GridSphereServlet.doGet(GridSphereServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 11:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Post the full exception please, that thing does not show anything.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 12:01 pm 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Ok, after more debugging, it turned out to be a class not found exception because I did not have jta.jar in Tomcat's classpath which seems necessary for Tomcat 5 but not Tomcat 4.

thanks, Jason


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