-->
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: Newbie - Hibernate Problem
PostPosted: Wed Apr 19, 2006 3:20 pm 
Newbie

Joined: Wed Apr 19, 2006 11:37 am
Posts: 3
Hello,

I am trying the Spring live application and want to create the database. I want to create a new table using the schema export. The .hbm file is this one:

<hibernate-mapping>
<class name="org.appfuse.model.User" table="app_user">
<id name="id" column="id" unsaved-value="0">
<generator class="increment" />
</id>
<property name="firstName" column="first_name" not-null="true"/>
<property name="lastName" column="last_name" not-null="true"/>
</class>
</hibernate-mapping>

The application context file is this one:

<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>org.hsqldb.jdbcDriver</value></property>
<property name="url"><value>jdbc:hsqldb:db/appfuse</value></property>
<property name="username"><value>sa</value></property>
<property name="password"><value></value></property>
</bean>

<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>org/appfuse/model/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>

<!-- Add DAOs here -->

<!-- Add Managers here -->
</beans>

When I am running the schema export, it seems to work:

jlenharc@W4DELESY0012104 /cygdrive/d/server/apache-tomcat-5.5.16/bin
$ 19.04.2006 21:13:21 org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
INFO - AbstractApplicationContext.close(383) | Closing application context [Root XmlWebApplicationContext]
INFO - AbstractBeanFactory.destroySingletons(355) | Destroying singletons in factory {org.springframework.beans.factory.
support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager]; Root of BeanFactory hi
erarchy}
INFO - LocalSessionFactoryBean.destroy(594) | Closing Hibernate SessionFactory
INFO - SessionFactoryImpl.close(531) | closing
INFO - XmlBeanDefinitionReader.loadBeanDefinitions(118) | Loading XML bean definitions from resource [/WEB-INF/applicati
onContext.xml] of ServletContext
INFO - AbstractXmlApplicationContext.refreshBeanFactory(68) | Bean factory for application context [Root XmlWebApplicati
onContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFacto
ry,transactionManager]; Root of BeanFactory hierarchy
INFO - AbstractApplicationContext.refresh(249) | 3 beans defined in ApplicationContext [Root XmlWebApplicationContext]
INFO - AbstractApplicationContext.initMessageSource(337) | No MessageSource found for context [Root XmlWebApplicationCon
text]: using empty StaticMessageSource
INFO - UiApplicationContextUtils.initThemeSource(67) | No ThemeSource found for [Root XmlWebApplicationContext]: using R
esourceBundleThemeSource
INFO - AbstractApplicationContext.refreshListeners(358) | Refreshing listeners
INFO - DefaultListableBeanFactory.preInstantiateSingletons(168) | Pre-instantiating singletons in factory [org.springfra
mework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager]; R
oot of BeanFactory hierarchy]
INFO - AbstractBeanFactory.getBean(158) | Creating shared instance of singleton bean 'dataSource'
INFO - DriverManagerDataSource.setDriverClassName(90) | Loaded JDBC driver: org.hsqldb.jdbcDriver
INFO - AbstractBeanFactory.getBean(158) | Creating shared instance of singleton bean 'sessionFactory'
INFO - Environment.<clinit>(462) | Hibernate 2.1.4
INFO - Environment.<clinit>(491) | hibernate.properties not found
INFO - Environment.<clinit>(522) | using CGLIB reflection optimizer
INFO - Binder.bindRootClass(229) | Mapping class: org.appfuse.model.User -> app_user
INFO - LocalSessionFactoryBean.afterPropertiesSet(372) | Building new Hibernate SessionFactory
INFO - Configuration.secondPassCompile(613) | processing one-to-many association mappings
INFO - Configuration.secondPassCompile(622) | processing one-to-one association property references
INFO - Configuration.secondPassCompile(647) | processing foreign key constraints
INFO - Dialect.<init>(82) | Using dialect: net.sf.hibernate.dialect.HSQLDialect
INFO - SettingsFactory.buildSettings(62) | Use outer join fetching: false
INFO - ConnectionProviderFactory.newConnectionProvider(53) | Initializing connection provider: org.springframework.orm.h
ibernate.LocalDataSourceConnectionProvider
INFO - TransactionManagerLookupFactory.getTransactionManagerLookup(33) | No TransactionManagerLookup configured (in JTA
environment, use of process level read-write cache is not recommended)
INFO - DriverManagerDataSource.getConnectionFromDriverManager(152) | Creating new JDBC connection to [jdbc:hsqldb:db/app
fuse]
INFO - SettingsFactory.buildSettings(102) | Use scrollable result sets: true
INFO - SettingsFactory.buildSettings(105) | Use JDBC3 getGeneratedKeys(): false
INFO - SettingsFactory.buildSettings(108) | Optimize cache for minimal puts: false
INFO - SettingsFactory.buildSettings(114) | echoing all SQL to stdout
INFO - SettingsFactory.buildSettings(117) | Query language substitutions: {}
INFO - SettingsFactory.buildSettings(128) | cache provider: net.sf.ehcache.hibernate.Provider
INFO - Configuration.configureCaches(1093) | instantiating and configuring caches
INFO - SessionFactoryImpl.<init>(119) | building session factory
INFO - SessionFactoryObjectFactory.addInstance(82) | no JNDI name configured
INFO - Dialect.<init>(82) | Using dialect: net.sf.hibernate.dialect.HSQLDialect
INFO - Configuration.secondPassCompile(613) | processing one-to-many association mappings
INFO - Configuration.secondPassCompile(622) | processing one-to-one association property references
INFO - Configuration.secondPassCompile(647) | processing foreign key constraints
INFO - Configuration.secondPassCompile(613) | processing one-to-many association mappings
INFO - Configuration.secondPassCompile(622) | processing one-to-one association property references
INFO - Configuration.secondPassCompile(647) | processing foreign key constraints
INFO - SchemaExport.execute(98) | Running hbm2ddl schema export
INFO - SchemaExport.execute(117) | exporting generated schema to database
INFO - ConnectionProviderFactory.newConnectionProvider(53) | Initializing connection provider: org.springframework.orm.h
ibernate.LocalDataSourceConnectionProvider
INFO - DriverManagerDataSource.getConnectionFromDriverManager(152) | Creating new JDBC connection to [jdbc:hsqldb:db/app
fuse]
INFO - SchemaExport.execute(160) | schema export complete
INFO - AbstractBeanFactory.getBean(158) | Creating shared instance of singleton bean 'transactionManager'
INFO - HibernateTransactionManager.afterPropertiesSet(231) | Using DataSource [org.springframework.jdbc.datasource.Drive
rManagerDataSource@650646] from Hibernate SessionFactory for HibernateTransactionManager
INFO - ContextLoader.initWebApplicationContext(98) | Using context class [org.springframework.web.context.support.XmlWeb
ApplicationContext] for root WebApplicationContext
INFO - ContextLoader.initWebApplicationContext(101) | Published root WebApplicationContext [org.springframework.web.cont
ext.support.XmlWebApplicationContext: displayName=[Root XmlWebApplicationContext]; startup date=[Wed Apr 19 21:13:22 CES
T 2006]; root of ApplicationContext hierarchy; config locations=[/WEB-INF/applicationContext.xml]; ] as ServletContext a
ttribute with name [interface org.springframework.web.context.WebApplicationContext.ROOT]

But if I browse the database, I cannot find the table definitions. I also selected the right database. Does anyone sees a failure within the configuration files or hibernate handling?

Thanks,
nort


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.