hibernate

Spring/Hibernate/Junit example of testing DAO against HSQLDB

Hi guys, I'm working on trying to implement a JUnit test to check the functionality of a DAO. (The DAO will create/read a basic object/table relationship). The trouble I'm having is the persistence of the DAO (for the non-test code) is being completed through an in-house solution using Spring/Hibernate, which eliminates the usual *.hb...

SQLiteJDBC giving org.sqlite.MetaData.getImportedKeys not yet implemented error with Hibernate

Hi all, SQLiteJDBC was giving me the following exception when used with hibernate's "hbm2ddl.auto = update" setting: org.sqlite.MetaData.getImportedKeys not yet implemented Any solutions? I found one below, and am posting it here for my future reference, but anyone else have any better ideas? ...

NoSQL or Ehcache caching ?

I'm building a Route Planner Webapp using Spring/Hibernate/Tomcat and a mysql database, I have a database containing read only data, such as Bus Stop Coordinates, Bus times which is never updated. I'm trying to make the app run faster, each time the application is run it will preform approx 1000 reads to the database to calculate a rout...

How to disable Hibernate flooding logs

Hibernate is flooding my IDE console with tons of unnecessary informations at every connection. I already read out the documentation and googled trying to solve this issue but till now the problem "persists". My persistence.xml: < persistence > ... < property name="hibernate.show_sql" value="false" /> < property name="hibernate.use_sq...

Connection drop problem with Hibernate-mysql-c3p0

hi all, This is an issue which I have seen all across the web. I will bring it up again as till now I don't have a fix for the same. I am using hibernate 3. mysql 5 and latest c3p0 jar. I am getting a broken pipe exception. Following is my hibernate.cfg file. com.mysql.jdbc.Driver ...

Where to open sessions in a Spring/Hibernate stack?

I'm trying to figure out a good design for a Spring/Hibernate app. When creating such an app, it appears like there are a handful of major decisions. The first major decision seems to be where to put the session/transaction boundary. It seems like I have 3 major choices: as a filter before controllers are even invoked, immediately bel...

"Dynamic" java validation framework?

AFAIK JSR-303 is the standard bean validation system. I don't know whether it could do validations like this (I guess no): if an object has a deleted flag set, you cannot modify the object you cannot change the start date property, after the date is passed you cannot decrease some integer properties in the bean So how can I handle v...

HQL : LEFT OUTER JOIN

Hi all, I have two tables and respective classes in java.The mapping in the HBM.xml is as follows : <class name="com.hcl.spring.db.sample.model.Parts" table="MARM_PARTS"> <id name="partNo" type="int" column="PART_NO"> <generator class="increment" /> </id> <property name="imageId" column="IMAGE_ID"></property> <property name="groupId"...

Saving tree-structures in Databases

Hello everyone. I use Hibernate/Spring and a MySQL Database for my data management. Currently I display a tree-structure in a JTable. A tree can have several branches, in turn a branch can have several branches (up to nine levels) again, or having leaves. Lately I have performanceproblemes, as soon as I want to create new branches on d...

Fill object data from several tables using hibernate mapping

Hi all, I'd like to know if it is possible to fill up a class data from database using the hibernate hbm (mapping). For instance: public class someClass { List<OtherClass> otherClasses; List<YetAnotherClass> yetAnotherClasses; //Constructors ? class OtherClass { String name; //setters, ge...

org.hibernate.PropertyNotFoundException

hi i am new to hibernate, i m using the following code and getting the following error public class OperProfile { private String empId; private long age; private String name; public long getAge() { return age; } public void setAge(long age) { this.age = age; } public String getEmpId() { return empId; } public void setEmpId(...

HQL(hibernate) timestamp range match

I need to write a query to get an object between a range of time, currently the query looks like this: Timestamp from = ... Timestamp to = ... getHibernateTemplate().find("from " + Person.class.getName() + " ml where ml.lastModifiedOn>="+from.toString()+" and m1.lastModifiedOn<=" + to.toString()); However, this doesnot work for ob...

What is the best way to implement multilingual domain objects using NHibernate?

What is the best way to design the Domain objects which can have multi-lingual fields. An example can be a Product class with Description being multi-lingual. I have found few links but could not decide which one is the best way. http://fabiomaulo.blogspot.com/2009/06/localized-property-with-nhibernate.html (This stores all localised ...

Info on Seam's EntityQuery?

I've been working with Seam and JPA/Hibernate for quite some time, but have just started looking at making use of the EntityHome and EntityQuery classes more. EntityHome seems relatively straightforward in terms of what it is and how I can leverage it. But, EntityQuery is a bit less clear. I understand the ability to grab, for example...

Service bus Vs direct database access

What are the advantages of using an ESB instead of directly accessing a database (via Hibernate or JDBC). I know you can reuse the messages on the bus, but could you not just package up your database access code into a jar and distribute it to the different systems that need access (Assuming all the accessing systems support Java)? ...

Hibernate criterion Projection alias not being used

Do Hibernate Projection aliases even work? I could swear it just doesn't. At least, it doesn't do what I would expect it to do. Here is the java: return sessionFactory.getCurrentSession().createCriteria( PersonProgramActivity.class ).setProjection( Projections.projectionList().add( Projections.alias( Projectio...

Spring / Hibernate project with Tomcat and JQuery.

Hi, I have a Dynamic Web Project that implements Spring and Hibernate using a Tomcat Server (v6). I'm lauching Tomcat with my Eclipse Galileo and I'm not getting any errors in the console but Tomcat is rendering my webpages randomly. The page just keep loading but without displaying anything, there's nothing on the console either. When...

Hibernate HQL to basic SQL (no joins)

Hello everybody, I working on a project with Hibernate and we need to replace Hibernate with some "home made persistence" stuff. The idea is that the project is big enough, and we have many HQL queries. The problem is with the queries like select a,b from table1, table2 on t1.table1=t2.table2 Basically all joins are not supported by ...

Annotations: methods vs variables

I was always sure (don't know why) that it's better to add annotations to variables, but while browsing the Hibernate doc http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-hibspec-collection I noticed they tend to annotate the methods. So should I put my annotations before methods, like this: @Entity pu...

Hibernate Beans generator

Hi, Does anybody know if there is any program able to create beans classes from a SQL file ? Thank you. ...