hibernate5.2.4:每次运行hibernate都会创建表

我导入的jar包是required里所有和jdbc
hibernate.cfg.xml
注意hbm2ddl.auto属性

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory>
  <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.password">scott</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:orcl</property>
  <property name="hibernate.connection.username">scott</property>
  <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.format_sql">true</property>
  <property name="hibernate.hbm2ddl.auto">update</property>
  <mapping resource="entity/Emp.hbm.xml"/>
  <mapping resource="entity/Dept.hbm.xml"/>
 </session-factory>
</hibernate-configuration>

emp映射文件

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
 <class name="entity.Emp" table="EMP">
  <id name="empno" type="java.lang.Integer"/>
  <property name="ename" type="java.lang.String"/>
  <property name="job" type="java.lang.String"/>
  <property name="mgr" type="java.lang.Integer"/>
  <property name="hiredate" type="java.sql.Date"/>
  <property  name="sal" type="java.lang.Double"/>
  <property  name="comm" type="java.lang.Double"/>
  <many-to-one class="entity.Dept" column="deptno" name="d"/>
 </class>
</hibernate-mapping> 

dept映射文件

 <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
 <class name="entity.Dept" table="DEPT">
  <id name="deptno" type="java.lang.Integer"/>
  <property generated="never" lazy="false" name="dname" type="java.lang.String"/>
  <property generated="never" lazy="false" name="loc" type="java.lang.String"/>
  <list name="l" table="EMP">
   <key column="deptno"/>
   <list-index column="deptNo"/>
   <one-to-many class="entity.Emp"/>
  </list>
    </class>
    </hibernate-mapping>

java测试类

 package test;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;

import entity.Emp;

public class Test {
    public static void main(String[] args) {
        StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build();

        SessionFactory sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();
        Session session = sessionFactory.openSession();
        session.beginTransaction();
        Emp e = new Emp();
        e.setEmpno(652);
        session.save(e);
        session.getTransaction().commit();

    }
}

控制台信息

十一月 21, 2016 8:56:30 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.4.Final}
十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
十一月 21, 2016 8:56:31 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
十一月 21, 2016 8:56:31 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
十一月 21, 2016 8:56:32 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thava:191)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
    at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)
    at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
    at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890)
    at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855)
    at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304)
    at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54) 

如果我把hbm2ddl属性换成create也会造成这种冲突,请问大神怎么破

3个回答

using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thava:191)首先确定这个驱动包是否正确,然后在tomcat的lib包下面放入你的oracle数据驱动包jar包,希望能解决

qq_15731659
qq_15731659 我的驱动包是ojdbc6应该没问题吧
接近 3 年之前 回复

总算是知道怎么做了,具体原因不知道。如果有碰到类似问题的朋友。可以在主配置文件 配置一下 default_schema 值为用户名。如果有外键冲突问题,可以在多对一加个foreign-key属性,值为约束名。当然最简单的方法就是把生成策略删除。以上是针对oracle数据库。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
高分悬赏 hibernate5.2.4:每次运行hibernate都会创建表
我导入的jar包是required里所有和jdbcrnhibernate.cfg.xmlrn注意hbm2ddl.auto属性rn[code=html]rnrnrn rn oracle.jdbc.driver.OracleDriverrn scottrn jdbc:oracle:thin:@127.0.0.1:1521:orclrn scottrn org.hibernate.dialect.Oracle10gDialectrn truern truern updatern rn rn rn[/code]rnemp映射文件rn[code=html]rnrnrnrn rn rn rn rn rn rn rn rn rn rnrn[/code]rndept映射文件rn[code=html]rnrnrnrn rn rn rn rn rn rn rn rn rn[/code]rnjava测试类rn[code=java]rnpackage test;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.boot.MetadataSources;rnimport org.hibernate.boot.registry.StandardServiceRegistry;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnrnimport entity.Emp;rnrnpublic class Test rn public static void main(String[] args) rn StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build();rnrn SessionFactory sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();rn Session session = sessionFactory.openSession();rn session.beginTransaction();rn Emp e = new Emp();rn e.setEmpno(652);rn session.save(e);rn session.getTransaction().commit();rnrn rnrn[/code]rn控制台信息rn[code=text]rn十一月 21, 2016 8:56:30 下午 org.hibernate.Version logVersionrnINFO: HHH000412: Hibernate Core 5.2.4.Finalrn十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment rnINFO: HHH000206: hibernate.properties not foundrn十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment buildBytecodeProviderrnINFO: HHH000021: Bytecode provider name : javassistrn十一月 21, 2016 8:56:31 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager rnINFO: HCANN000001: Hibernate Commons Annotations 5.0.1.Finalrn十一月 21, 2016 8:56:31 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntityrnWARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.rn十一月 21, 2016 8:56:32 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntityrnWARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configurernWARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@127.0.0.1:1521:orcl]rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001001: Connection properties: user=scott, password=****rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001003: Autocommit mode: falsern十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections rnINFO: HHH000115: Hibernate connection pool size: 20 (min=1)rn十一月 21, 2016 8:56:32 下午 org.hibernate.dialect.Dialect rnINFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialectrn十一月 21, 2016 8:56:33 下午 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnectionrnINFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@473b3b7a] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.rnHibernate: rn rn create table EMP (rn empno number(10,0) not null,rn ename varchar2(255 char),rn job varchar2(255 char),rn mgr number(10,0),rn hiredate date,rn sal double precision,rn comm double precision,rn deptno number(10,0),rn primary key (empno)rn )rn十一月 21, 2016 8:56:33 下午 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleExceptionrnWARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statementrnorg.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statementrn at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:524)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:273)rn at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:203)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:110)rn at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:177)rn at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:66)rn at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)rn at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)rn at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)rn at test.Test.main(Test.java:15)rnCaused by: java.sql.SQLSyntaxErrorException: ORA-00955: 名称已由现有对象使用rnrn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)rn at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)rn at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)rn at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)rn at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)rn at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)rn at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)rn at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890)rn at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855)rn at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304)rn at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)rn[/code]rnrn如果我把hbm2ddl属性换成create也会造成这种冲突,请问大神怎么破
关于hibernate5.2.4的一个问题:每次运行hibernate都会创建表
我导入的jar包是required里所有和jdbcrnhibernate.cfg.xmlrn注意hbm2ddl.auto属性rn[code=html]rnrnrn rn oracle.jdbc.driver.OracleDriverrn scottrn jdbc:oracle:thin:@127.0.0.1:1521:orclrn scottrn org.hibernate.dialect.Oracle10gDialectrn truern truern updatern rn rn rn[/code]rnemp映射文件rn[code=html]rnrnrnrn rn rn rn rn rn rn rn rn rn rnrn[/code]rndept映射文件rn[code=html]rnrnrnrn rn rn rn rn rn rn rn rn rn[/code]rnjava测试类rn[code=java]rnpackage test;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.boot.MetadataSources;rnimport org.hibernate.boot.registry.StandardServiceRegistry;rnimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;rnrnimport entity.Emp;rnrnpublic class Test rn public static void main(String[] args) rn StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build();rnrn SessionFactory sessionFactory = new MetadataSources(registry).buildMetadata().buildSessionFactory();rn Session session = sessionFactory.openSession();rn session.beginTransaction();rn Emp e = new Emp();rn e.setEmpno(652);rn session.save(e);rn session.getTransaction().commit();rnrn rnrn[/code]rn控制台信息rn[code=text]rn十一月 21, 2016 8:56:30 下午 org.hibernate.Version logVersionrnINFO: HHH000412: Hibernate Core 5.2.4.Finalrn十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment rnINFO: HHH000206: hibernate.properties not foundrn十一月 21, 2016 8:56:30 下午 org.hibernate.cfg.Environment buildBytecodeProviderrnINFO: HHH000021: Bytecode provider name : javassistrn十一月 21, 2016 8:56:31 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager rnINFO: HCANN000001: Hibernate Commons Annotations 5.0.1.Finalrn十一月 21, 2016 8:56:31 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntityrnWARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.rn十一月 21, 2016 8:56:32 下午 org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntityrnWARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-mapping. Use namespace http://www.hibernate.org/dtd/hibernate-mapping instead. Support for obsolete DTD/XSD namespaces may be removed at any time.rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configurernWARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001005: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@127.0.0.1:1521:orcl]rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001001: Connection properties: user=scott, password=****rn十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorrnINFO: HHH10001003: Autocommit mode: falsern十一月 21, 2016 8:56:32 下午 org.hibernate.engine.jdbc.connections.internal.PooledConnections rnINFO: HHH000115: Hibernate connection pool size: 20 (min=1)rn十一月 21, 2016 8:56:32 下午 org.hibernate.dialect.Dialect rnINFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialectrn十一月 21, 2016 8:56:33 下午 org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnectionrnINFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@473b3b7a] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.rnHibernate: rn rn create table EMP (rn empno number(10,0) not null,rn ename varchar2(255 char),rn job varchar2(255 char),rn mgr number(10,0),rn hiredate date,rn sal double precision,rn comm double precision,rn deptno number(10,0),rn primary key (empno)rn )rn十一月 21, 2016 8:56:33 下午 org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl handleExceptionrnWARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statementrnorg.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statementrn at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlString(AbstractSchemaMigrator.java:524)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.applySqlStrings(AbstractSchemaMigrator.java:470)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.createTable(AbstractSchemaMigrator.java:273)rn at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:71)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:203)rn at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:110)rn at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:177)rn at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:66)rn at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:309)rn at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:445)rn at org.hibernate.boot.internal.MetadataImpl.buildSessionFactory(MetadataImpl.java:170)rn at test.Test.main(Test.java:15)rnCaused by: java.sql.SQLSyntaxErrorException: ORA-00955: 名称已由现有对象使用rnrn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:440)rn at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)rn at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:837)rn at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:445)rn at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)rn at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)rn at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:193)rn at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:999)rn at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)rn at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1890)rn at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1855)rn at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:304)rn at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)rn[/code]rnrn如果我把hbm2ddl属性换成create也会造成这种冲突,请问大神怎么破
为什么每次启动都会运行安装类?!
在使用带安装类的安装项目生成的快捷方式启动程序,每次都会调用安装类代码.rnrn以前不是这样的,现在即使重建安装项目也没有用,不知道是什么原因,哪位大大知道!?rn
IE6下,JS的每次运行都会缓冲,怎么办?
鼠标的漏斗一直在转,虽然时间短,但是影响美观,并且在更改背景图片的position时,也是会一闪一闪的。
IQKeyboardManager每次运行都会断点.m文件
APP导入了IQKeyboardManager,只要打开All Exception获取异常断点,每次编译都会捕获到一个IQKeyboardManager的断点,具体如下: 那我们该怎么操作? 看图看图
每次运行Office2010都会重新配置的问题解决
每次运行Office2010都会重新配置
每次建MFC运行都会出现错误
[color=#FF0000]->[/color] OPENFILENAME m_ofn; // open file parameter blockrnc:\program files\microsoft visual studio\vc98\mfc\include\afxdlgs.h(122) : error C2146: syntax error : missing ';' before identifier 'm_ofn'rn
hibernate创建表?
可不可以只用一个java class 或其hbm.xml文件就创建一张表?现在创建表必须两个都提供,我仅仅想创建表,没必要为创建表而额外生成一个java class,或者在那儿设置属性可以达到?
Hibernate创建表
用Hibernate创建表的方法
为什么每次都会重编
为什么我的项目 每次都会重编依赖项的代码。rn并没对依赖的代码作修改。rnrn编译器中哪里可以设置呢,VS9.0。
每次用ExecuteNonQuery都会错!!
每次用ExecuteNonQuery都会错!!rn我想在特定的地方修改数据,代码如下:rnstring strUpdt = " UPDATE studentmessage SET unit = '"+ unit.Text + "' ,unitid = '" + unitid.Text + "' , studentno ='0 ' , birthyear = '" + birthyear.Text + "',studentsort='" + studentsort.Text + "',studentsource='" + studentsourcesort + "'WHERE studentno = " + 0;rnSqlCommand myCommand2 = new SqlCommand ( strUpdt , sqlConnection1 ) ;rnmyCommand2.ExecuteNonQuery ( ) ;!!!!!!!这里错!!!!!rnsqlConnection1.Close ( ) ;rn我还用对过以上方式的数据添加,修改!rn不知道利用数据集的修改记录该怎么写。rnDataRow anyRow =dataSet61.studentmessage.Rows[0];rnanyRow["unit"]= unit.Text;rnanyRow["unitid"]= unitid.Text;rnanyRow["报考号"]= 0;rnanyRow["birthyear"]= birthyear.Text;rnanyRow["studentsort"]= studentsort.Text ;rnanyRow["studentsourcesort"]= studentsourcesort.Text ;rndataSet61.studentmessage.Rows.Add(anyRow);!!!!这里错!!!!rnsqlDataAdapter1.Update(dataSet61);!!!!!这里错!!!!rn我这么写程序提示:数据库有一条记录,怎样修改以上的程序呢?rn望指教。
Hibernate数据库查询同一内容每次查询内容都会变化问题
首先要保证session及事物正常的开启与关闭。session的clear操作。 最重要的一点,数据库是否设置了事物隔离级别 2
Hibernate无法自动创建表
首先介绍其中的一个属性hbm2ddl.auto,这个就是这个方案的核心属性,有四个值:create,create-drop,update,validate;<!-- 启动时删数据库中的表,然后创建,退出时不删除数据表<property name="hibernate.hbm2ddl.auto">create</property>--><!-- 启动时删数据库中的表,然后创建,退出时自动删除所有表<p
Hibernate自动创建表
只要在hibernate.cfg.xml添加这句话,就可以自动生成数据表 update update:表示自动根据model对象来更新表结构,启动hibernate时会自动检查数据库,如果缺少表,则自动建表;如果表里缺少列,则自动添加列。 还有其他的参数: create:启动hibernate时,自动删除原来的表,新建所有的表,所以每次启动后的以前数据都会丢失。 create-drop:启动
hibernate 创建表问题~~~~~~
我想根据现有的映射文件生成另外一张新表,新表的名称和映射文件不相同。rn举例来说:rn 系统已经有Test表和Test.hbm.xml文件,我想根据Test.hbm.xml文件去生成一张跟Test表结构一摸一样的表,表名称叫bak_Test20080808080808.rnrn 小弟在此谢过!!
我的hibernate不能创建表?
我用的是spring+hibernate+struts架构,却无法在tomcat启动时创建表,hibernate配置文件如下:rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnspring配置文件如下:rnrnrnrnrnrn rn oracle.jdbc.driver.OracleDriverrn jdbc:oracle:thin:@127.0.0.1:1521:tbmisrn tbmisrn tbmisrn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn com/tel/user/bo/User.hbm.xmlrn rn rn rn rn org.hibernate.hql.classic.ClassicQueryTranslatorFactoryrn org.hibernate.dialect.Oracle9Dialectrn 200rn creatern truern rn rn rn rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn PROPAGATION_REQUIREDrn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn PROPAGATION_REQUIREDrn rn rn rnrn rn rn rnrnrnrn rn rn rn
hibernate自动创建表的问题
hibernate中多对多映射需要创建一个中间表,但是中间表不能有联合主键,我想用rn Configuration configuration=new Configuration().configure();rn SchemaExport export=new SchemaExport(configuration);rn export.create(true, true);rn这三句自动创建表;rn创建表的映射文件 课程表的映射文件rn rn rn rn rn 学生表的映射文件rn rn rn rn rn这样子会生成一个中间表,但是有一个联合主键,在添加数据的时候会报出一个违反唯一主键的错误rn怎么样才能生成一个中间表,但是中间表又不会有任何主键呢...rn求大侠解决...
hibernate不能自动创建表
hibernate不能将实体类在mysql中生产相对应的表rn配置:[code=XML]rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn org.hibernate.dialect.MySQL5Dialectrn rn creatern truern rn rn rn rn fc.po.*rn rn rn [/code]rnrn实体类的超类[code=Java]@SuppressWarnings("serial")rn@MappedSuperclassrnpublic abstract class PoAbs implements Serializablern private String dataId;rn private String createTime;rn private String creater;rn private String updateTime;rn private String updater;rn @Idrn @Column(name = "data_id")rn @GeneratedValue(generator = "system-uuid")rn @GenericGenerator(name = "system-uuid", strategy = "uuid")rn public String getDataId() rn return dataId;rn rn public void setDataId(String dataId) rn this.dataId = dataId;rn rn public String getCreateTime() rn return createTime;rn rn public void setCreateTime(String createTime) rn this.createTime = createTime;rn rn public String getCreater() rn return creater;rn rn public void setCreater(String creater) rn this.creater = creater;rn rn rn rn public String getUpdateTime() rn return updateTime;rn rn public void setUpdateTime(String updateTime) rn this.updateTime = updateTime;rn rn public String getUpdater() rn return updater;rn rn public void setUpdater(String updater) rn this.updater = updater;rn rn rn[/code]rnrn实体类:[code=Java]@Entityrn@Table(name="community")rnrnpublic class Community extends PoAbs rn private String communtiyName;rn private String address;rn private District district;rn rn public String getCommuntiyName() rn return communtiyName;rn rn public void setCommuntiyName(String communtiyName) rn this.communtiyName = communtiyName;rn rn public String getAddress() rn return address;rn rn public void setAddress(String address) rn this.address = address;rn rn @ManyToOne(fetch=FetchType.LAZY)rn public District getDistrict() rn return district;rn rn public void setDistrict(District district) rn this.district = district;rn rn rnrn[/code]
hibernate自动创建表
有时候,当重装系统时.数据库丢失程序无法运行,安装好数据库后,需重新建表.可以利用hibernate配置文件属性,或程序实现 表的创建. 1.配置文件属性: value 的值为: validate 加载hibernate时,验证创建数据库表结构 create 每次加载hibernate,重...
利用 Hibernate 创建表
在hibernate.cfg.xml文件中配置一段这样的话: &amp;lt;?xml version='1.0' encoding='utf-8'?&amp;gt; &amp;lt;!DOCTYPE hibernate-configuration PUBLIC &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot; &quot;http:/...
关于Hibernate自动创建表
只需要在hibernate.cfg.xml里面加入&amp;lt;property name=&quot;hbm2ddl.auto&quot;&amp;gt;create&amp;lt;/property&amp;gt;就好了。关于这个红色的create,其实它有多种形式。1.create:每次启动时,删除所有当前数据库下面的所有表,然后重新创建。2.update:保留表,但每次更新数据。3.create-drop:启动hibernate时,自动创...
Hibernate自动创建表
Hibernate自动创建表 : 只要在hibernate.cfg.xml添加这句话,就可以自动生成数据表 update update:表示自动根据model对象来更新表结构,启动hibernate时会自动检查数据库,如果缺少表,则自动建表;如果表里缺少列,则自动添加列。 还有其他的参数: create:启动hibernate时,自动删除原来的表,新建所有的表,所以每次启...
hibernate创建表失败
首先自己要注意自己的MYSQL版本,然后设置对应的方言兼容性模式&amp;lt;property name=&quot;hibernate.dialect&quot;&amp;gt;org.hibernate.dialect.MySQLDialect&amp;lt;/property&amp;gt;需要注意的是5.5一下版本可以使用&amp;lt;property name=&quot;hibernate.dialect&quot;&amp;gt;org.hibernate.dial...
hibernate 创建表问题
我的hibernate程序无法创建表,不知是何问题,请高手指点rnrn## Oraclernrn#hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialectrnhibernate.dialect net.sf.hibernate.dialect.OracleDialectrnhibernate.connection.driver_class oracle.jdbc.driver.OracleDriverrnhibernate.connection.username ctirnhibernate.connection.password ctirnhibernate.connection.url jdbc:oracle:thin:@10.10.0.190:1521:sxitrnrnrnpackage person;rnrnimport net.sf.hibernate.SessionFactory;rnimport net.sf.hibernate.cfg.Configuration;rnimport net.sf.hibernate.tool.hbm2ddl.SchemaExport;rnrnpublic class TestPersonModel rn private static SessionFactory sessionFactory;rn public static void main(String[] args) throws Exceptionrn Configuration conf= new Configuration().addClass(MyPeronModel.class);rnrnrn SchemaExport dbExport=new SchemaExport(conf);rn dbExport.setOutputFile("sql_out_lib\\sql.txt");rn dbExport.create(true, true);rn rnrnrnrn运行后不任何异常报错信息,但无法创建表,并且生成的sql.txt文件也是空的rn
spring整合hibernate自动创建表
配置如下: hibernate.hbm2ddl.auto=update hibernate.show_sql=true hibernate.dialect=org.hibernate.dialect.MySQL5Dialect classpath:cn/itcast/ssh/domain/*.hbm.xml            
页面每次刷新都会弹出窗口
点击页面一个button弹出窗口,button是服务器端控件,用的是Page.ClientScript.RegisterStartupScript的方法写的,每次刷新或者点浏览器的前进后退都会弹出这个窗口,怎么才能只在点击按钮时才弹出呀??
hibernate持久层,java代码创建表
java代码创建表
hibernate自动创建表的配置
配置自动创建表: &amp;lt;prop key=&quot;hibernate.hbm2ddl.auto&quot;&amp;gt;update&amp;lt;/prop&amp;gt;//首次创建项目时用,项目稳定后一般注释 这里有4个值:   update:表示自动根据model对象来更新表结构,启动hibernate时会自动检查数据库,如果缺少表,则自动建表;如果表里缺少列,则自动添加列。 还有其他的参数: create:启动...
hibernate和mysql不能创建表
莫名其妙的原因不能通过hibernate或者spring data jpa的方法创建表,这个时候一定要检查一下自己的数据表中的字段是否是mysql的保留字,包括表也是这样。将可疑的字段名称修改一下可能会有一定的帮助...
【java】——Hibernate代码创建表
小编最近正在进行Hibernate框架的学习,根据代码建立数据库表实现了一个小例子,跟读者朋友进行分享。
【Hibernate】从类创建表
这两天开始了陆陆续续的学习Hibernate视频了,看到了视频中老师通过建类使用Hibernate创建了一张表,觉得很神奇,之前一直都是先建表后根据表创建类,所以心头一腔热血也试了试这块的内容。看着老师操作觉得挺简单的,但是轮到我真正落实起来的时候真是各种奇葩问题都来了。所以留下博客一篇用来记录这个神奇的时刻。     首先是Hibernate环境搭建,引入相应的Jar包(这里学到了一招,建立
用hibernate 创建表出错
本人新手,按照网上的教程,用hibernate创建数据库表,结果悲剧了。下面是贴出的错误。求大神指点错在哪里了rn
Hibernate5.2.4环境搭建源码
Hibernate5.2.4环境搭建,包含最新jar包,eclipse 4.6,JDK8. 代码详细注释,配置文件详细讲解
装了oracle 10g后,每次开机都会自动运行它。
装了oracle 10g后,每次开机都会自动运行它。rn怎么样才能让它开机后不自动运行??
为什么每次运行都会出现“text is read only”消息框?
为什么每次运行VB都会出现“text is read only”消息框?这对程序的数据输入和读出有没有影响?
这个文件每次运行都会出现一个“安全警告”的提示框?
我有一个MD5的校验程序,每次运行都会出现一个“安全警告”提示框:“无法验证发行者....”,查看文件属性,在常规选项卡中发现多了一个安全标记:此文件来自其它计算机。。。rnrn附图:rnrn1、“安全警告”提示框rnhttp://img25.photo.163.com/kowloons/656540/120457833.jpgrnrn2、安全标记rnhttp://img25.photo.163.com/kowloons/656540/120458117.jpgrnrn3、程序下载地址:rnhttp://upserver1.ys168.com/ys168up/D1/yy.aspx?f=050250E3E4E1E0E3D5H7A05AKG7F8E3C2D9D6E0C2F9G8UV6SUR962D6A01A20A01I5F6G5D9E7D9E3D6E7A24E2E2C8rnrn有人知道是怎么回事吗?
为什么我的窗口布局,在每次调试运行后,都会不见的
为什么我的窗口布局,在每次调试运行后,都会不见的,需要重新来搞,我重置过窗口布局,但还是没有用,到底是怎么回事,真是烦死了,以前不会的,以前只要结束运行,窗口布局,都还会在的,现在除了个源代码,什么窗口都没有了
为何vc每次编译运行都会跳出一个筐?如何去掉?
为何vc每次编译运行都会跳出一个筐?如何去掉?rn弄得菜牛心情很不好!!!
eclipse每次运行Android项目都会重启虚拟机
Android虚拟机开启的时候。运行一个Android项目就会又重启一个Android虚拟机。rn删除.android文件重建一个Android虚拟机也不行。rnrn启动的时候会经常出现:rnerror loading ddms preferences
appfuse2+spring mvc每次运行mvn jetty:run都会更新mysql数据库
rt,每次运行mvn jetty:run都会清空mysql中的数据库,然后重新create table并且插入一下junit数据,请问下怎么回事啊?
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制