create a new hibernate session in multi-thread program
How to create a new hibernate session at a new thread ? The SessionFacatory was managed by Spring. ...
How to create a new hibernate session at a new thread ? The SessionFacatory was managed by Spring. ...
I got this exception while calling a named HQL query in an EJB. I'm quite puzzled though because the app. functions fine with named queries and all. Only when it throws some exception, it can't find the JDBCExceptionHelper. javax.ejb.EJBTransactionRolledbackException: Unexpected Error java.lang.NoClassDefFoundError: org/hibernate/exce...
This is a general purpose question but from my experiences it does not appear to be possible to reference a property belonging to a embedded class within another. Directory Directory parent. Name // embedded String name; i cant seem to be able to create a Query that does find a directory where parent of parent's name is somet...
greetings all, i got this exception in the following method and i don't know why: List<Date> temps = getCurrentSession() .createQuery( "select distinct date(uploadDate) from FileDomain where projectId=:projectId" + " and entityId not in(select fileId from FileVersio...
In netbeans I was looking for a hibernate javadoc option (the code completion is working properly but I was looking for the description of the functions). I got one JAR file for Hibernate Javadoc : hibernate-3.2.2.ga-javadoc.jar but couldn't find a way to include this and make it work in NetBeans. I included the jar file in the Javadoc...
Hi, In Domain Logic and SQL, Martin Fowler talks about 3 styles of interfacing with a database: Transaction Script Domain Model, and Logic in SQL What I'd like to know is: When employing Hibernate for persistence, which of the above 3 styles is typically used and/or encouraged? Is there any 4th style when using Hibernate? (In co...
Hi Could someone help me understand that why am I getting the following error when I am trying to persist ServiceProvider entity? java.sql.SQLException: Cannot add or update a child row: a foreign key constraint fails (`springmvc/businesslocation`, CONSTRAINT `FK5CB747B5A26ED80E` FOREIGN KEY (`state_id`) REFERENCES `state` (`id`)) at ...
I'm using netbeans 6.9 and Hibernate and I'm trying to insert some values in a database (postgres) but I get the following exception: INFO: Not binding factory to JNDI, no JNDI name configured Exception in thread "main" org.hibernate.MappingException: Unknown entity: SELECTPACK.beanClass at org.hibernate.impl.SessionFactoryImp...
Hi, I am building data base system for electronic components. Unfortunatly other programs, that will use some of my tables need to have white spaces in column names. Ive tried in my hbm.xml file something like this with property: ... property name="partGroup" column="part group" type="string" ... of course hibernate wont create table...
Hi, During performing some performance tuning in my application I have noticed, that hibernate query cache is never used. I am quite sure I have it properly set up: hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider hibernate.cache.use_query_cache=true I use setCacheable(true) on queries I want to cache I have set u...
Hi, I use Hibernate to persist inherited objects but I got this message when I try to persist objects in database: org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [update Widget set CONTAINER_ID=? where WIDGET_ID=?]; nested exception is org.hibernate.exception.SQLGrammarExceptio...
I'm trying to get data from assotiation N:N, but I receive blank field. There are my Hibernate mapping class: @Entity @Table(name = "companies") public class Company extends NamedEntity { //some_code @ManyToMany( targetEntity = com.hqcargo.shippingstock.domain.CompanyProfile.class, cascade = {CascadeType.ALL, CascadeTy...
Assuming that the two are compatible, how can I force Maven 2 to use Ehcache 2.2.0 instead of Ehcache 1.2.3 with Hibernate 3.3.2.GA? Essentially, I wish to replace the puzzling and practically cyclic dependency chain Hibernate Ehcache Integration 3.3.2.GA => Ehcache 1.2.3 => Hibernate 3.2.0.cr3 => Ehcache 1.2 with Hibernate Ehca...
When I change a domain object, rather than updating the database record, I'd like to archive the old record record and create a new one. I'd like to force GORM to do this automatically. For example, if I had this domain class: class User { String username String email Boolean active } then I'd like user.email = email us...
I have several mapped objects in my JPA / Hibernate application. On the network I receive packets that represent updates to these objects, or may in fact represent new objects entirely. I'd like to write a method like <T> T getOrCreate(Class<T> klass, Object primaryKey) that returns an object of the provided class if one exists in ...
In the spring documentation regarding testing, it states: Avoid false positives when testing ORM code When you test code involving an ORM framework such as JPA or Hibernate, flush the underlying session within test methods which update the state of the session. Failing to flush the ORM framework's underlying sessi...
I'm wondering how to best implement a property (here, LatestRequest) which is read-only, backed by a query. Here, I have an Export, which can be requested to happen multiple times. I'd like to have a property on the Export to get the latest ExportRequest. At the moment, I've got a many-to-one mapping with a formula, like this: <class ...
I need to implement a revision system for articles in my grails web app. After searching grails forum, stackoverflow, grails plugins and googling internet, I have ended up with 3 options: Option 1 - Using the grails Envers plugin (see http://code.google.com/p/grails-envers-plugin/). Has anyone used it successfully? Or using Envers with...
Hi there, am using hibernate merge method, to deal with detached instance from entity, and i thought that the return of this method will be a new fetched instance from database as hibernate saveOrUpdate method, but that wasn't the case, and i think it's logic as it's a detached instance, so is there a better way to return the new instan...
I have problem writing HQL to display distinct applicationId with the latest application (newest createDate) for the following data in the table. +---------------+-------------+----------+---------------------+ | applicationId | firstName | lastName | createDate | +---------------+-------------+----------+--------------------...