Hibernate Performance against Progress Open Edge database
by Joe Hansen
Hi All,
I know that I am comparing apples to oranges here. But I am surprised to
find that a simple Hibernate query ("from Photoset p") takes 4 times as much
time as JDBC. I know that there is overhead involved with the benefits that
Hibernate offers. But don't you think 4 times is just too slow? Please let
me know if there is a way to get a better performance out of Hibernate.
Thank you!
Here are the results:
# Records: 5000
# Mapped Columns: 2
Hibernate Query / Plain JDBC: 560 ms / 150 ms
# Mapped Columns: 3
Hibernate Query / Plain JDBC: 1200 ms / 270 ms
# Mapped Columns: 5
Hibernate Query / Plain JDBC: 1680 ms / 390 ms
Thanks,
Joe
/* Hibernate Code */
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Date beginTime = new Date();
Query query = session.createQuery("from Photoset p");
List<Photoset> photosets = query.list();
System.out.println(photosets.size() + " photoset(s) found:");
Date endTime = new Date();
tx.commit();
session.close();
System.out.println("Total Time Taken: " + (endTime.getTime() -
beginTime.getTime()) + " ms");
/* Photoset.hbm.xml - Hibernate Mapping file */
<hibernate-mapping>
<class name="Photoset" table="pub.fotoset">
<id name="id" column="fotosetnum">
<generator class="sequence">
<param name="sequence">pub.nextfotosetnum</param>
</generator>
</id>
<property name="title" column="fotosettitle" />
</class>
</hibernate-mapping>
/* Photoset.java */
public class Photoset {
private Long id;
private String title;
Photoset() {}
public Photoset (String title) {
this.title = title;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
/* JDBC Code that runs 4 times faster */
Date beginTime = new Date();
PreparedStatement pstmt = con.prepareStatement("select fotosetnum,
fotosetitle from pub.fotoset");
ResultSet rs = pstmt.executeQuery();
int numFotosets = 0;
while (rs != null && rs.next()) {
Photoset photoset = new Photoset();
photoset.setId(rs.getLong(1));
photoset.setTitle(rs.getString(2));
numFotosets++;
}
rs.close();
System.out.println("# Photosets:" + numFotosets);
Date endTime = new Date();
System.out.println("Total Time Taken: " + (endTime.getTime() -
beginTime.getTime()) + " ms");
15 years, 5 months
Hibernate site
by Nelson Teixeira
Will someone tell us what happend with hibernate.org site ? It has been a
whole week since it gone offline, and was replaced by the maintenance page
and still no news about it. Why are hibernate team keeping it's users in the
dark ?
That is very strange and it's creating speculations about it. Hibernate team
should release a annoucement of what is happening.
15 years, 5 months
Does someone know the maintenance status of hibernate.org?
by Marco.Huber@partner.bmw.ch
Hi mailing list,
I try since days to access hibernate.org, but only get this "You caught us doing a little maintenance. We're sorry that you can't access the main website right now. Please use the links below until we get things up and running again. Thank you for your patience." Page.
Does someone know how long the forum, documentation etc. are offline? Is there a date when hibernate is online again?
Hope someone has an answer.
Regards
Marco
P. S.: The same happens if you want to access the JBoss forums :(.
15 years, 5 months
lazy loading fields in embeddable objects
by Rajiv Poddar
Hi,
How to lazy load the fields in the Embeddable object. I am doing this:
@Entity
Class A{
...
@Embedded
private B b;
}
------------------
@Embedded
Class B{
@Basic(fetch=FetchType.LAZY)
@Column(...)
private String foo;
}
So here the field b in class A should be lazily loaded, but it's NOT.
What am I missing or doing wrong?
Thanks
15 years, 5 months
Anyone aware of an implementation of SessionBroker on top of JPA or Hibernate API?
by Sebastien Tardif
Anyone aware of an implementation of SessionBroker on top of JPA or
Hibernate API?
I mean by SessionBroker, an encapsulation of the fact that 2
EntityManager potentially pointing to 2 different databases are
involved. So that the client is coded like just one EntityManager is
used. Similar to:
http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/b136
98/oracle/toplink/sessionbroker/SessionBroker.html
This is having for constraint that each EntityManager do not reference
the same classes so that query like below can be redirected to the right
EntityManager transparently because can lookup the right EntityManager
using the class:
* em.createNativeQuery("select id from Mag, Mag.class")
* em.createQuery("from Category c where xyz");
15 years, 5 months
org.hibernate.QueryException: The collection was unreferenced ??
by oliver.hibernate
hi,everyone
i got this exception when i want use createFilter method to count the number of children records,
org.hibernate.QueryException: The collection was unreferenced
anyone can tell me how to solve the problem??thank you very much!!
2009-04-12
oliver.hibernate
15 years, 6 months
Hello
by Brajesh Patel
Hello All,
How to get good document.
--
Thanks
15 years, 6 months