Update Hibernate

Asked

Viewed 134 times

0

The situation is as follows, when placing the property <property name="hibernate.hbm2ddl.auto" value="update"/>, nothing else works, no query works anymore. log always ends with

: jul 27, 2017 8:28:18 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@6974a715] 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.

if I remove this update property, I can make queries normally, but generate tables, no... I can’t generate tables and I need to generate them from Hibernate.

This is my 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 do hibernate -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle8iDialect"/>
            <property name="show_sql" value="true"/>

            <!-- atualiza o banco, gera as tabelas se for 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>
  • If you put the log in DEBUG displays some more error message?

  • no, no mistake.

  • Because you need to generate the tables by Hibernate, can’t access the database and create the tables directly there? A tip, never use this property in a production environment, it may cause you problems, the documentation of Hibernate itself suggests this resource only for development environment and not for production. Can you test in another database? Maybe Oracle8idialect has some bug.

  • I’ve changed Dialect and it hasn’t solved

  • the bank is remote and to access the bank, I need to remotely access the server and have a lot of problems in this. I wanted to avoid these problems.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.