java - Hibernate property update -
when use hibernate property <property name="hibernate.hbm2ddl.auto" value="update"/>
, consult doesn't work.
the hibernate log is:
: jul 27, 2017 8:28:18 pm org.hibernate.resource.transaction.backend.jdbc.internal.ddltransactionisolatornonjtaimpl getisolatedconnection info: hhh10001501: connection obtained jdbcconnectionaccess [org.hibernate.engine.jdbc.env.internal.jdbcenvironmentinitiator$connectionproviderjdbcconnectionaccess@6974a715] (non-jta) ddl execution not in auto-commit mode; connection 'local transaction' committed , connection set auto-commit mode.
if remove update property, can consults, generate tables don't. can't generate tables , need this.
this persistence.xml
:
<?xml version="1.0" encoding="utf-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> <persistence-unit name="#####" transaction-type="resource_local"> <provider>org.hibernate.jpa.hibernatepersistenceprovider</provider> <properties> <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.oracledriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@#####:#####:#####"/> <property name="javax.persistence.jdbc.user" value="#####"/> <property name="javax.persistence.jdbc.password" value="#####"/> <!-- propriedades hibernate --> <property name="hibernate.dialect" value="org.hibernate.dialect.oracle8idialect"/> <property name="show_sql" value="true"/> <!-- atualiza o banco, gera tabelas se preciso --> <property name="hibernate.hbm2ddl.auto" value="update"/> <!-- configuring connection pool --> <property name="hibernate.c3p0.min_size" value="10"/> <property name="hibernate.c3p0.max_size" value="20"/> <property name="hibernate.c3p0.acquire_increment" value="1"/> <property name="hibernate.c3p0.idle_test_period" value="3000"/> <property name="hibernate.c3p0.max_statements" value="50"/> <property name="hibernate.c3p0.timeout" value="1800"/> </properties> </persistence-unit> </persistence>
have tried 'create'??
<property name="hbm2ddl.auto">create</property>
Comments
Post a Comment