I have a java application running on a Windows server. This application queries an Oracle 10 database through Hibernate. I have a query getting back a collection of 215 entities with 6 string fields each . It takes around 20s to get them back (stat gotten from hibernate stats)
I got back sql generated by hibernate and ran it through SQLPlus, got between 300-500ms run time.
I launched H2 console with ojdbc driver (the same used by my app) and connected to my db (from the same computer as my app run to avoid network problems), ran the sql I got from Hibernate several times, I got the same 300-500ms run time as from SQLPlus so I guess my problem comes from Hibernate but I don't know where to look anymore.
The database is on another server but I got <1ms ping to that server so I don't think network is involved.
My configuration :
javax.persistence.jdbc.driver=oracle.jdbc.driver.OracleDriver
javax.persistence.jdbc.url=jdbc:oracle:thin:@xxxxx
javax.persistence.jdbc.user=xxxxx
javax.persistence.jdbc.password=xxxxx
hibernate.ejb.naming_strategy=org.nuiton.jpa.hibernate.OracleCompliantImprovedNamingStrategy
hibernate.dialect=xxxx.MyDialect
hibernate.hbm2ddl.auto=update
hibernate.show_sql=false
hibernate.use_sql_comments=false
hibernate.format_sql=true
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
hibernate.c3p0.min_size=3
hibernate.c3p0.max_size=5
hibernate.c3p0.timeout=1800
hibernate.c3p0.max_statements=50
hibernate.generate_statistics = false
Naming Strategy : https://gitlab.nuiton.org/retired/nuiton-jpa/blob/develop/nuiton-jpa-hibernate/src/main/java/org/nuiton/jpa/hibernate/OracleCompliantImprovedNamingStrategy.java
Dialect :
public class MyDialect extends Oracle10gDialect {
public MyDialect() {
super();
registerColumnType(Types.DOUBLE, "number");
}
}
My entities look like (with getters and setters) :
public abstract class AbstractJpaRequestedArticle extends AbstractJpaEntity implements Serializable {
private static final long serialVersionUID = 7293079560062973232L;
public static final String PROPERTY_ID = "id";
public static final String PROPERTY_QUANTITY = "quantity";
public static final String PROPERTY_PRIORITY = "priority";
public static final String PROPERTY_ARTICLE = "article";
public static final String PROPERTY_REQUESTED_LIST = "requestedList";
public static final String PROPERTY_DESTINATION_LOCATION = "destinationLocation";
@Id
protected String id;
protected double quantity;
protected String priority;
@ManyToOne
protected Article article;
@OneToOne
protected RequestedList requestedList;
@ManyToOne
protected Location destinationLocation;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = new JpaEntityIdFactoryResolver().newId(this);
}
}
@Override
public String getId() {
return id;
}
AbstractJpaEntity only defines equals, hashcode and default toString