-->
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.  [ 6 posts ] 
Author Message
 Post subject: help with GWT and import.sql
PostPosted: Wed Jul 08, 2009 11:34 am 
Newbie

Joined: Wed Jul 08, 2009 11:30 am
Posts: 3
Hi to everyone!
I have a problem with hibernate. I'm developing a GWT project, and on server-side I use the hibernate technology to map my persistent classes. In the spring configuration file I wrote:

<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:mem:smartTasksDB" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" scope="singleton">
<property name="sessionFactory">
<ref bean="smartTasksSessionFactory" />
</property>
</bean>

<bean id="smartTasksSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
scope="singleton">
<property name="packagesToScan">
<list>
...
</list>
</property>
<property name="dataSource">
<ref bean="myDataSource" />
</property>
<property name="hibernateProperties">
<ref bean="hibernateProperties"/>
</property>
</bean>

<bean id="hibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
</props>
</property>
</bean>

To test my application I would like to use the import.sql file to "initialize" my database. But unfortunately the file is ignored :( Its insert clauses are never read and never executed...

The file is in the war directory. I have the latest versions of hibernate's jars and the mapping is completely done by annotations (no hbm files)....

Can anyone help me?

Thanks a lot,
Marco


Top
 Profile  
 
 Post subject: Re: help with GWT and import.sql
PostPosted: Fri Jul 10, 2009 3:15 am 
Newbie

Joined: Wed Jul 08, 2009 11:30 am
Posts: 3
Maybe you need more informations? I don't know what to do, I've tried everything :(


Top
 Profile  
 
 Post subject: Re: help with GWT and import.sql
PostPosted: Fri Jul 17, 2009 3:27 am 
Newbie

Joined: Wed Jul 08, 2009 11:30 am
Posts: 3
can anyone help me? :(


Top
 Profile  
 
 Post subject: Re: help with GWT and import.sql
PostPosted: Fri Jul 31, 2009 7:48 pm 
Newbie

Joined: Wed Jun 17, 2009 11:08 am
Posts: 7
I'm not exactly sure of what you are trying to accomplish, but if I understand correctly, your "import.sql" contains some data that needs to initialize your database: why don't you just run your sql script against your db instance before you start up the app? Initialization data should only be ran once anyways.


Top
 Profile  
 
 Post subject: Re: help with GWT and import.sql
PostPosted: Mon Aug 17, 2009 7:52 pm 
Newbie

Joined: Mon Aug 17, 2009 2:02 am
Posts: 2
Hi,

Did you manage to get this issue resolved as I am having the same problem?

Cheers


Top
 Profile  
 
 Post subject: Re: help with GWT and import.sql
PostPosted: Fri Sep 04, 2009 6:28 am 
Beginner
Beginner

Joined: Wed Nov 19, 2008 6:39 am
Posts: 44
Location: Mumbai, India
You just need to add a file named import.sql in your classpath root and set either create or create-drop as your hibernate.hbm2ddl.auto property.

_________________
Thx,
Murugesan.
Web: http://www.murugesanpitchandi.com


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