Hey guys!
I have a problem. I working this JPAContainer + Hibernate and it works very long time. For example page with SQLContainer loading 60ms and same page with JPA Container loading 1.30s.
With JPAContainer in console I see many tons sql queries - for each entity - query; Entity Person haven`t links to other tables;
Code with jpacontainer:
JPAContainer<Person> container = JPAContainerFactory.make(Person.class,
"persistence-unit");
table.setContainerDataSource(container);
Code with SQLContainer:
JDBCConnectionPool pool = null;
try {
pool = new SimpleJDBCConnectionPool("org.postgresql.Driver",
"jdbc:postgresql://127.0.0.1:5432/postgres", "postgres",
"pwd");
} catch (SQLException e) {
e.printStackTrace();
}
TableQuery tq = new TableQuery("Person", pool);
SQLContainer sqlContainer = null;
try {
sqlContainer = new SQLContainer(tq);
} catch (SQLException e) {
e.printStackTrace();
}
table.setContainerDataSource(sqlContainer);
My persistence.xml file:
<persistence-unit name="persistence-unit" transaction-type="RESOURCE_LOCAL">
<jta-data-source>java:jboss/datasources/mfc-frontendDS</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.use_sql_comments" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
</properties>
</persistence-unit>
What do I do not truly?
Thanks.