hibernate

Embed hibernate hbm.xml mappings in jar

Is it possible to embed the hibernate mapping hbm.xml’s to the jar and avoid manual reference in applicationContext.xml like <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernatePr...

Database Diff Tool

As a Java Developper using JPA/Hibernate, I am looking for a will help diff a database that has been generated by Hibernate with a production database. I've already looked at LiquiBase's abilities LiquiBase which is quite nice... Unfortunlately it is plagued by some weird bugs: Re-Create Foreign Keys for no reason Re-Create Indexes fo...

An erlang database schema generator

Is there a way I can generate a database schema from an erlang application like I can do with hibernate. ...

Client Side sorting + Hibernate Paging?

I use GWT for UI and Hibernate/Spring for buisness-layer.Following GWT widget is used to display the records.(http://collectionofdemos.appspot.com/demo/com.google.gwt.gen2.demo.scrolltable.PagingScrollTableDemo/PagingScrollTableDemo.html).I assume the sorting is done in client side. I do not retrieve the entire result set since its huge...

Hibernate displaytag big lists

Hi there, I'm using displaytag to build tables with data from my db. This works well if the requested list isn't that big but if the list size grows over 2500 entries, fetching the result list takes very long (more than 5 min.). I was wondering if this behavior is normal. How you handle big list / queries which return big results? ...

CF9 ORM Replicate Left Outer Join

Hi there I am using the ORM features in CF9 and am just a bit stuck on how to replicate a left outer join query.. I have a TaskList CFC component output="false" persistent="true"{ property name="iTaskListID" fieldtype="id" generator="native"; property name="sTitle" ormtype="string" length="50"; property name="task" fieldtype="one-to-...

how to connect to mutiple databases in hibernate

Hi, I am new bee to Hibernate and trying out things. One thing that seems to amuse all is how to connect to different databases? I have two questions here a) if in the same web app i need to connect to mysql and oracle how do i do it? b) i am using mysql and have two databases test1 and test2, how to connect and retrieve data? I have rea...

Set Hibernate root folder

Dear All! I use Hibernate in an extension-like server-side application, and I put my binaries to the Extensions folder of the server application. The problem is, that if I run the server, the root folder is the root folder of the server application, and not the root of the binaries. Thus, Hibernate searches the config file in that folde...

Convert pair comparison sql for MS SQL in Hibernate

We use hibernate to handle different databases. There's a problem about using pair comparison sql when the data source is MS SQL. We want to know how to convert this statement for ms sql. The following is the simplified sql. notice: column1 and column2 both are uuid and numeric type. ( in ms sql will be numeric(19,0) the converted s...

Ordering by a Column that's not in the Group By or Enapsulated in an Aggregate

I have a problem getting this JPA query to work on MS SQL Server 2008. The background is as follows: Users create jobs for clients, of which there are many. I am displaying a list of his most recently used clients to the user to make the selection easier. SELECT DISTINCT c FROM Client c JOIN c.jobs j WHERE j.user = ?1 O...

JPA Spring Hibernate Dao List problem

I am using JPA/Spring/Hibernate as my persistence mechanism for my application. Currently I am running into unit test problems where when I ask for some objects I get the right amount returned from the DAO that correspond to the number of rows in the database, but they are all of the exact same instance. Here is the findByName() metho...

Hibernate sort by properties of inner bean ?

In my domain model I have following Classes.A 'UserProfile' has one 'SecurityPrincipal' class SecurityPrincipal{ private String loginId; private String password; private Date registeredData; private int status; } class UserProfile { private String name; private String company; private SecurityPrincipa principal } I want to ge...

Hibernate and order by using column values

Is there a way I can pull off the below query (order by followed by a like) using hibernate criteria api? select * from table where first_name like 'bar%' order by first_name like 'bar%' desc ...

Hibernate, save the previous state of an object

Is there any generally accepted, proven-to-work way using hibernate, that keeps a history of an entitys changes in the database? We need to keep track of quite some objects and we want to be able to undo changes to objects. I tried using the interceptors of hibernate, but the old state of the object is only available when doing merge()...

What is the correct way of overriding hashCode () and equals () methods of persistent entity?

I have a simple class Role: @Entity @Table (name = "ROLE") public class Role implements Serializable { @Id @GeneratedValue private Integer id; @Column private String roleName; public Role () { } public Role (String roleName) { this.roleName = roleName; } public void setId (Integer id) { ...

To equals and hashcode or not on entity classes, that is the question.

I have been trying to reason about the best way to handle whether it is generally good practice to implement hashcode and equals on entities (I mean entity in the general sense but in most cases it will be a JPA entity). In Chapter 24 of the Hibernate manual http://docs.jboss.org/hibernate/core/3.3/reference/en/html/best-practices.html ...

Thread deadlock blocked on Hibernate transaction

I have one process which creates a database entity and then launches a second process. It then waits on the second process to find and update the database entity before completing its processing, and thereby committing the database entity. The trouble seems to be that since the initial process which performed the entity creation has no...

ClassCastException trying to cast retrieved JPA object to concrete class

I am not certain what I am doing wrong, but I have a class that has a class within it, so when I save the Skill class the user class also gets created, so when I do the join and I want to pull everything in at one time, I get a classcastexception. This is how I am calling my query. val retrieved_obj = em.createNamedQuery("findAllSkills...

Learning Struts, Spring and Hibernate

I'm trying to learn Struts, Spring and Hibernate, I was just wondering if anyone knows any good sources or some examples that makes use of all the technologies (like a small web application). Thanks. ...

Problem with Hibernate Shards & JNDI

I'm trying to run a sample program for hibernate shards. I'm all done with it but whenever I run the test program I get an Exception javax.naming.NoInitialContextException: Need to specify class name in environment or system property After googling I got to know that I've to set the JNDI properties. I did like this Hashtable env = ...