-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate JPA bootstrap persist error
PostPosted: Mon Mar 19, 2012 10:10 pm 
Newbie

Joined: Mon Jan 11, 2010 11:21 am
Posts: 1
Hi! I was trying to measure the impact for changing a fully jdbc application, to one that handles persistence and transaction with spring and hibernate. I've started with some minor impact tests but I'm having an error while running the following command,
view plaincopy to clipboardprint?
Code:
entityManager.persist(user); 

and I cannot see heads nor tails.
The exception thrown is the following
Caused by: java.sql.SQLException: Unexpected token: SELECT in statement [insert into UserTable (lastLogin, password, username) values (?, ?, ?) select scope_identity()]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)

An the following is the configuration.

persistence.xml
Code:
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL" > 
        <class>com.zuppelli.flows.domain.User</class> 
        <properties> 
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/> 
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/> 
        </properties> 
    </persistence-unit> 


servlet definition file
view plaincopy to clipboardprint?
Code:
<bean id="dataSource" destroy-method="close" 
        class="org.springframework.jndi.JndiObjectFactoryBean"> 
        <property name="jndiName" value="java:comp/env/jdbc/flows" /> 
        <property name="resourceRef" value="true" /> 
    </bean> 
 
    <bean id="entityManagerFactory" 
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
        <property name="dataSource" ref="dataSource" /> 
        <property name="persistenceUnitName" value="default" /> 
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter" /> 
    </bean> 
 
    <bean id="jpaVendorAdapter" 
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> 
        <property name="showSql" value="true" /> 
    </bean> 
 
    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
        <property name="entityManagerFactory" ref="entityManagerFactory" /> 
    </bean> 
    <tx:annotation-driven transaction-manager="transactionManager"/> 
 
    <bean 
        class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /> 


Tomcat's server.xml
Code:
<GlobalNamingResources> 
    <Resource driverClassName="org.hsqldb.jdbcDriver" name="jdbc/flows" password="" type="javax.sql.DataSource" url="jdbc:hsqldb:hsql://localhost/flows" username="SA"> 
     
    </Resource> 
    <!-- Editable user database that can also be used by 
         UserDatabaseRealm to authenticate users 
    --> 
    <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/> 
  </GlobalNamingResources> 


These are the dependencies I'm using.
Code:
    <dependencies>
        <dependency>
           <groupId>org.springframework.webflow</groupId>
           <artifactId>org.springframework.binding</artifactId>
           <version>2.0.5.RELEASE</version>
        </dependency>
        <dependency>
           <groupId>org.springframework.webflow</groupId>
           <artifactId>org.springframework.js</artifactId>
           <version>2.0.5.RELEASE</version>
        </dependency>
        <dependency>
           <groupId>org.springframework.webflow</groupId>
           <artifactId>org.springframework.webflow</artifactId>
           <version>2.0.5.RELEASE</version>
        </dependency>
        <dependency>
           <groupId>javax.servlet</groupId>
           <artifactId>jstl</artifactId>
           <version>1.2</version>
        </dependency>
        <dependency>
           <groupId>taglibs</groupId>
           <artifactId>standard</artifactId>
           <version>1.1.2</version>
        </dependency>
        <dependency>
           <groupId>ognl</groupId>
           <artifactId>ognl</artifactId>
           <version>2.7.3</version>
        </dependency>
        <dependency>
           <groupId>javax.persistence</groupId>
           <artifactId>persistence-api</artifactId>
           <version>1.0.2</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-entitymanager</artifactId>
           <version>3.4.0.GA</version>
        </dependency>
        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-jdbc</artifactId>
           <version>2.5.6</version>
        </dependency>
        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-orm</artifactId>
           <version>2.5.6</version>
        </dependency>
        <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-core</artifactId>
           <version>3.3.1.GA</version>
        </dependency>
        <dependency>
           <groupId>org.slf4j</groupId>
           <artifactId>slf4j-log4j12</artifactId>
           <version>1.5.2</version>
        </dependency>
        <dependency>
           <groupId>hsqldb</groupId>
           <artifactId>hsqldb</artifactId>
           <version>1.8.0.1</version>
        </dependency>
        <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-aop</artifactId>
           <version>2.5.6</version>
        </dependency>
    </dependencies>


do you have any ideas why is this failing?


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

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.