hibernate Annotation 无法正常生成表结构

xinxing028 2010-08-16 04:30:39
项目中使用Annotation进行配置
但数据库无法根据注解生成相应的表

那位大牛帮忙看看!!!!!

附1:控制台执行信息

信息: Starting Servlet Engine: Apache Tomcat/6.0.18
2010-8-16 16:19:30 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2010-8-16 16:19:30 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2010-8-16 16:19:32 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2010-08-16 16:19:32,425 [// - - ] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
2010-08-16 16:19:32,581 [// - - ] INFO org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon Aug 16 16:19:32 CST 2010]; root of context hierarchy
2010-08-16 16:19:32,800 [// - - ] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D:\tomcat6\webapps\iphone\WEB-INF\classes\spring\applicationContext-datasource.xml]
2010-08-16 16:19:33,635 [// - - ] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D:\tomcat6\webapps\iphone\WEB-INF\classes\spring\applicationContext-hibernate-dao.xml]
2010-08-16 16:19:33,977 [// - - ] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D:\tomcat6\webapps\iphone\WEB-INF\classes\spring\applicationContext-service.xml]
2010-08-16 16:19:34,027 [// - - ] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D:\tomcat6\webapps\iphone\WEB-INF\classes\spring\applicationContext-validator.xml]
2010-08-16 16:19:34,549 [// - - ] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1d7a082: defining beans [dataSource,jdbcTemplate,sessionFactory,transactionManager,userDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,commonItemService,userService,validator,messageInterpolator,resourceBundleLocator]; root of factory hierarchy
2010-08-16 16:19:35,000 [// - - ] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.3.0.GA
39 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
43 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
50 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
63 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
2010-08-16 16:19:35,621 [// - - ] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.iphone.po.CommonItem
2010-08-16 16:19:35,749 [// - - ] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.iphone.po.CommonItem on table t_citem
2010-08-16 16:19:35,934 [// - - ] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.iphone.po.User
2010-08-16 16:19:35,935 [// - - ] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.iphone.po.User on table t_user
2010-08-16 16:19:35,968 [// - - ] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
2010-08-16 16:19:35,968 [// - - ] INFO org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean - Building new Hibernate SessionFactory
2010-08-16 16:19:35,979 [// - - ] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
1185 [main] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
1645 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: MySQL, version: 5.0.27-community-nt
1645 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
1736 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQL5Dialect
1754 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
1758 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1758 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1758 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1758 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
1758 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
1761 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1761 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1761 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
1763 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
1763 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 4
1763 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1763 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1763 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
1764 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1776 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {false=0, true=1}
1777 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1777 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
1798 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1801 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1801 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1801 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
1801 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
1935 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
2689 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
3037 [main] INFO org.hibernate.validator.util.Version - Hibernate Validator 4.1.0.Final
2010-08-16 16:19:38,259 [// - - ] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 5829 ms
2010-08-16 16:19:38,704 [// - - ] INFO org.apache.struts.validator.ValidatorPlugIn - Loading validation rules file from '/WEB-INF/validator-rules.xml'
2010-08-16 16:19:38,705 [// - - ] INFO org.apache.struts.validator.ValidatorPlugIn - Loading validation rules file from '/WEB-INF/validation.xml'
2010-8-16 16:19:41 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
...全文
620 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xinxing028 2010-08-16
  • 打赏
  • 举报
回复
附3: service配置

<!-- component-scan自动搜索@Component , @Controller , @Service , @Repository等标注的类 -->
<!-- 默认值如果适合,该项可以不用修改 -->
<context:component-scan base-package="com.iphone.service" />
xinxing028 2010-08-16
  • 打赏
  • 举报
回复
附3: hibernate-dao配置

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
default-autowire="byName" default-lazy-init="false">

<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>

<!-- packagesToScan可以自动搜索某个package的全部标记@Entity class -->
<property name="packagesToScan">
<list>
<value>com.**.po</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<!--常用数据库方言 MySQL5Dialect,SQLServerDialect,OracleDialect,SybaseDialect,DB2Dialect,HSQLDialect -->
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.query.substitutions">true 1, false 0</prop>
<prop key="hibernate.default_batch_fetch_size">4</prop>
</props>
</property>
</bean>

<!--Hibernate TransactionManager-->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>

<!-- component-scan自动搜索@Component , @Controller , @Service , @Repository等标注的类 -->
<context:component-scan base-package="com.**.dao"/>

</beans>
xinxing028 2010-08-16
  • 打赏
  • 举报
回复
附2:spring配置信息

<!-- 数据源定义 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/dota"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</bean>

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧