JPA - Entitymanagerfactory - Slow execution

Asked

Viewed 83 times

1

Expensive,

I am playing with Persistências and something strange occurs when running from the eclipse. The same does not occur when running in the jar.

Has anyone been there? Eclipse Photon (4.8.0) + Maven + Entitymanagerfactory + JPA

Set 14, 2018 2:06:37 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
    name: XXX
    ...]
Set 14, 2018 2:06:37 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.16.Final}
Set 14, 2018 2:06:37 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Set 14, 2018 2:06:37 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Set 14, 2018 2:06:37 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] at URL [jdbc:sqlserver://localhost:1433;databaseName=DBTeste]
Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=sa, password=****}
Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Set 14, 2018 2:35:48 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.SQLServerDialect
Set 14, 2018 2:35:49 PM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@72ca7fc] 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.
Set 14, 2018 2:35:51 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
INFO: HHH000397: Using ASTQueryTranslatorFactory
Hibernate: 
    insert 
    into
        Conta
        (agencia, banco, numero, titular) 
    values
        (?, ?, ?, ?)

Look at the time interval.

Set 14, 2018 2:06:37 PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Set 14, 2018 2:35:48 PM org.hibernate.dialect.Dialect <init>

My pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.xxx</groupId>
    <artifactId>XXX</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>XXX</name>
    <url>http://xxxx.com</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
    </properties>

    <dependencies>

        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-entitymanager -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.1.16.Final</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>sqljdbc4</artifactId>
            <version>4.0</version>
        </dependency>

    </dependencies>
    <description>API teste</description>
</project>
  • Running using JAR is done from your machine as well? How long does it take with JAR? Try increasing the log level to DEBUG or TRACE for more information.

  • Yes, I run on the same machine... Doubt! I’m looking for references but I couldn’t find a way to increase the log without log4j. There would be another way?

  • I implemented the log4j and stops at the same point ... I will make a test with mysql and put the results..

  • Apparently for some reason I still don’t know, through the eclipse I can’t access the network. Even though DB is in my machine, there is a lock .... I’m trying to get around...

  • I am purposely using java 1.7 which in turn is not installed on my machine, I only refer to the eclipse to copy the project, since I am using Eclipse Photon which natively uses java 1.8. When I switch to java 1.8, I can run the application in eclipse by going back to java 1.7 the execution is hung. Even downloading the firewall persists the problem.

No answers

Browser other questions tagged

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