hibernate

Hibernate/JPA: Mapping entities to different databases

Hi guys, I have an application which manages 3 databases. I use hibernate with JPA on seam framework. So I have a persitence.xml file with three persitence-unit like this (I remove properties for db2 and db3): <persistence-unit name="db1" transaction-type="JTA" > <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta...

Spring and Hibernate: can't delete entry

Hi everyone, I stuck with entry deleting an entry from DB. I have Hibenrnate integrated with spring. RDMS is HyperSql and application server is Tomcat 6. For dependency management I use maven and for development I use Eclipse with maven plug-in. Hibernate is in version: 3.3.2.GA Spring is in version: 3.0.3.RELEASE HyperSql is in ver...

Hibernate = Column not found

I am running an aggregate function in java through hibernate and for some reason it is giving me this error: INFO Binary:182 - could not read column value from result set: l_date; Column 'l_date' not found. When I run the MySQL query the column names are l_date and logins and I can not figure out why it is not finding that. I have ...

Secondarytables or OnetoOne associations ?

Considering the following "model": USER Long: PK String: firstName String: lastName USER_EXT Long: PK String: moreInfo Date: lastModified I'm trying to find/create the correct Hibernate mapping (using Annotations) such that, with an HQL query as simple as "from User", it would generate the following SQL: sel...

are polymorphic join tables possible in Grails

Does anybody know if it is possible create and write to polymorphic join tables using grails. Are there any drawbacks from doing this ...

hibernate validator

Hi, I'd like to use hibernate (orm) together with hibernate validator. Within the documentation we can find the following: Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annot...

Hibernate / Java Object can not be converted to a Date

I have the following method in my java. For some reason when I try and cast l_month as a Date it says that the object can not be cast. In my sql statement I convert the date to just be the month using the DATE_FORMAT with '%M', so it just returns a list of month names and the number of logins for that month. How can I get that l_month fi...

hibernate circular foreign key

I have to test some code I have not myself written. It is an integration test: the application is running continuously on a server and my tests run against it. The tests are Selenium tests, they launch a browser, execute some JavaScript inside it to simulate user actions and checks if the database is correctly updated. I have to restore...

Using Hibernate to pull records based on the number of records in another table

I have a Users table that holds two different kinds of users (A and B). Type A users can have relationships with type B users (which is recorded in a Relationships table). The number of relationships that a Type A User can have with type B users is recorded in a field in another table. I want to have Hibernate return all type A users th...

HQL: Fetch Join Collections from Eager Table

I have four tables: RootNode // Will return multiple root nodes SubNode // Will return one sub node per root node SubNodeChildren1 // Will return multiple for each sub node SubNodeChildren2 // Will return multiple for each sub node and a similar entity structure: RootNode -> SubNode -> SubNodeChildren1 -> SubNode...

Using Hibernate inside a Glassfish 3 web service

I've got a Java application that uses Hibernate for persistence. Now I'm trying to expose part of this app as a web service deployed to Glassfish 3.0.1. The code that implements the service is in a JAR file that is deployed along with the WAR file into Glassfish. The service code in the WAR has no problem accessing the classes that us...

Best way to bootstrap a Spring MVC + hibernate application

I've tried using the Spring Templaate project in Springsource Toolsuite, but there appears to be a bug in the wizard. http://stackoverflow.com/questions/3490651/springsource-tool-suite-and-spring-template-project I'm looking for some recommendations on how to get the shell of a project. ...

Hibernate: failed to lazily initialize a collection of role, no session or session was closed

My code: @Test public void testAddRoleAndAddUser() { Role r = roleDao.findByProperty("name", "admin"); if(r == null) { r = new Role(); r.setName("admin"); r.setDescription("Just administrator."); roleDao.save(r); } User u = dao.get(1l); Set<Role> roles = u.getRoleSet(); logge...

What jar-files needed for gilead with GWT ?

I do not find a good tutorial on integrating gilead for GWT with hibernate. I miss the step what jar files to include in my application. Background: There is some example source code at: http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html to be found here, but I do not see that the same jars are used in the d...

Hibernate Monitoring Solution

Hello, I would like to monitor hibernate action. I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last version of hibernate 3.5.*? if it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created...

Problem with hibernate request (Oracle)

hello, i have a problem with my request, i don't understand why i have this error from keyword not found where expected my dao public List getAllDeclaration(String anneeEnCours) throws FiscaliteException { if (LOGGER.isDebugEnabled()) { LOGGER.debug("getAllDeclaration"); } // Creation de la connexion S...

Hibernate dependency issue with maven and xml parsing

I'm writing a GWT-Hibernate internal web application for our development group. Previously, I had written tools to parse up XML files which represented customer configuration gathered in the field for analysis. Now, I'm trying to add an UI front-end for the support group. The XML parsing code uses xpath and org.w3c.dom classes to consum...

Hibernate throws unique constraint violation exception while updating field part of unique key

Hi All, Below is the use case: I have a unique index defined on 3 columns say A,B,C. Assume the values in them are A1,B1,C1. My java code is adding a new record say A1,B1,C1 but before this record is added, i update the previous value from C1 to C2. While trying to add the new record (after the update), hibernate is throwing an unique c...

is there any liquibase issue with hibernate hbm2ddl create?

Hello Gurus! i'm having a light problem with liquibase and hibernate.I expect hibernate to create the schema when the hbm2ddl is set to create and then have liquibase polulate the database with an sql script file. i've notice that when on validate it behaves as describe and on create it doesn't Especially on a testing environment when...

newbie- Hibernate transitive persistence is not working

I have 2 tables parent/child which I am trying to insert records in. ParentID is a surrogate key in child table. I have cascade="all" in parent table's hbm.xml file. When I try to save both through my junit test case, both parent and child records get saved but when same thing is done through application running in jboss, record in paren...