Results 1 to 10 of 10

Thread: Problem with Struts + Spring + Hibernate

  1. #1
    Join Date
    May 2007
    Posts
    20

    Default Problem with Struts + Spring + Hibernate

    Hi,

    I have a (strange) problem using Hibernate together with Spring / Struts on a Tomcat Server. When I deploy my Project (using Eclipse WTP), I get the following error in the console:
    Code:
    14.06.2007 14:19:13 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    SCHWERWIEGEND: could not get database metadata
    com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703, SQLERRMC: SEQNAME
    .....
    .....
    14.06.2007 14:19:13 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    SCHWERWIEGEND: could not complete schema update
    com.ibm.db2.jcc.c.SQLException: DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703, SQLERRMC: SEQNAME
    But after this the deployment continues and I can access the tables with hibernate. I don't know why this appears, does anybody has an idea?
    To access hibernate I'm using the org.springframework.orm.hibernate3.LocalSessionFac toryBean-Class. For the datasource I'm using the com.mchange.v2.c3p0.ComboPooledDataSource-Class.
    And my database is a DB2-Database

    Thanks in advance

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    It is a WARNING not an error. You are using the schemaUpdate tool from hibernate it informs you that something couldn't be done (something with a sequence?). But it isn't stopping your application.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    May 2007
    Posts
    20

    Default

    Hi mdeinum,
    you're right, the application doesn't stop but I wonder because the message is marked as GRAVE, not just as warning. And it takes pretty long to deploy because hibernate is trying to do sth. that does'nt work and it takes a pretty long time (about 70!! seconds). Everytime I want to test something I have to wait because of this warning...
    Does anybody know if its possible to switch this behaviour of (whatever hibernate does there)...?

    Thanks

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    It isn't because of the warning that it takes so long, but it is because of the schemaUpdate that it takes so long. Just disable it (your schema wont' be automatically updated anymore!) and startup times should become faster.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    May 2007
    Posts
    20

    Default

    Hi mdeinum,

    I already set the schemaUpdate-Flag to false:

    Code:
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    	<property name="schemaUpdate" value="false" />
    	<property name="dataSource" ref="dataSource" />
    	<property name="mappingResources">
        		<list>
        			<value>Mandant.hbm.xml</value>
        			<value>Filiale.hbm.xml</value>
        		</list>
     	</property>
     	<property name="hibernateProperties">
     		<props>
     			<prop key="hibernate.hbm2ddl.auto">update</prop>
    	   	<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
    		<prop key="hibernate.show_sql">true</prop>
    		   	<prop key="hibernate.c3p0.timeout">20000</prop>	
    		   	<prop key="hibernate.format_sql">true</prop>
    		</props>
    	 </property>
    </bean>
    But theres no affect, it still takes so long...

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I think you need to remove the property.
    Code:
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    Last edited by karldmoore; Aug 30th, 2007 at 05:24 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  7. #7
    Join Date
    May 2007
    Posts
    20

    Default

    Thanks a lot, now it works fine...

  8. #8
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Great! I've just noticed a post on the Hibernate forum that looks like that same thing. Was that you as well? Might be an idea to post the solution there as well.
    Last edited by karldmoore; Aug 30th, 2007 at 05:24 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  9. #9
    Join Date
    May 2007
    Posts
    20

    Default

    Hi karldmoore,

    you're right, that was also me. I'll post the solution there... Thanks again...

  10. #10
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote Originally Posted by orribl View Post
    Hi karldmoore, you're right, that was also me. I'll post the solution there... Thanks again...
    Not a problem! I thought it looked familiar .
    Last edited by karldmoore; Aug 30th, 2007 at 05:23 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •