hibernate

Error in hibernate constraint

Hi In my project i m using using hibernate and oracle as DB. I am having two tables with foreign key relationship. In hibernate I m have one-to-many relationship. my one-to-many code set name="classname" cascade="all,all-delete-orphan one-to-many ..... on-delete="cascade" set But whenever i detele i am getting constraint violat...

Cleanest way to log who updated what in CF-ORM / Hibernate?

One of the requirements of my project is to log who (which Staff) updated what (from what version to what version). UI needs to show who updated entity X at what time and what are updated. What is the cleanest way to implement this? For discussion purpose, imagine... Account has a Contact, and I need to store who update the contact, w...

Knowing when hitting database vs cache

Given all the smarts around Hibernate and it's various caching strategies, how do I know if a certain operation is resulting in a physical database hit, or coming from the cache? ...

HibernateDaoSupport and native SQL

Hi I'm writing a DAO using spring and hibernate public class DaoImpl extends HibernateDaoSupport implements Dao {} For reading or updating data I'm using HQL getHibernateTemplate().bulkUpdate(...) but one of the queries is too complex for that and I need to use native SQL Query query = getSession().createSQLQuery(...) But doing tha...

Migrating to ORM

Stepwise, what would be a good way of integrating Spring and Hibernate into an existing JSF application that doesn't use ORM? ...

Hibernate Search - searching in given scope.

Hi, Let's say I have following classes. (only most important things included) public class Client { /* Some Properties */ } public class ClientDocumentAssociation { @ManyToOne private Client client; /* Some Properties */ } @Indexed public class Document { @OneToOne private ClientDocumentAssociation clientAsso...

How to use Hibernate Full Text Search

I am developing an application in struts 1.2 framework. I want to use hibernate full text search in my application. How can I use it? ...

constraint problems using apache derby and hbm2ddl

We are using Apache Derby 10.5.3.0_1 and hbm2ddl with Hibernate 3.3.x I get the following constraints error while pre-loading the SQL on an embedded derby database. If I remove the primary key(id) from the create table sql, it's able to create the table. Not sure what the problem is over here. create table user_flow (id integer not nul...

How do i create a Hibernate Criteria to order by some properties of collection

Say, i have an entity that has a history of operations as a collection. I want to sort entities by the date of the latest operation (it's the first element of history). i'd like to do something like this: criteria.addOrder(Order("history[0].date")) is this possible? ...

Hibernate load function left out of grails?

I noticed that the Grails hibernate plugin does not support the hibernate load function? Does anybody know why that is? In all of the documentation that I have seen, it seems that the accepted way to delete an object from a db is to do a get() with the object id followed by a delete(). While this works it makes an unnecessary database...

Grails 1.2.0 Deployment Problems: org.hibernate.MappingException

Hello, I'm having a frustrating problem with my Grails application. I'm able to run the application using both run-app and run-war without any issues, but when I try to deploy to a container, I get an exception that I'm not sure how to interpret. I've tried deploying on Glassfish, Tomcat, and Jetty, and I have the same issue in all thre...

using HQL Console in Intellij IDEA 9x: "Session is not created"

I'm trying to use the HQL Console feature of Intellij IDEA for interactively debugging HQL. We use JPA with Hibernate as the provider. I've configured the JPA Facet for the module as per this, as well as a DataSource. The HQL console seems to know about my entities, as it can auto-complete them in the console. But whenever I try a q...

handling hibernate UnsupportedOperationException: Can't write to a readonly object

what configuration parameters or session preferences need to set to fix Can't write to a readonly object ? Here is the stacktrace for more information Caused by: java.lang.UnsupportedOperationException: Can't write to a readonly object at org.hibernate.cache.ReadOnlyCache.lock(ReadOnlyCache.java:43) at org.hibernate.acti...

How do I reload a Roo project without clearing the database?

I've been learning how to build projects using Roo and am making good progress. I have the nucleus of a project which correctly displays my defined entities and allows me to create, edit, and delete the representative objects. I am using mysql at the database and I see that objects entered using the UI correctly appear in the mysql dat...

Hibernate HQL with interfaces

According to this section of the Hibernate documentation I should be able to query any java class in HQL http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-polymorphism Unfortunately when I run this query... "from Transaction trans where trans.envelopeId=:envelopeId" I get the message "Transaction is n...

hibernate composite key

Is it necessary that composite-id should be mapped to class ?? can it be like this ? <composite-id> <key-property=..../> <key-property=..../> </composite-id> or should be <composite-id class=....> <key-property=..../> <key-property=..../> </composite-id> should that necessary that if we have composite key then that class ...

not able to delete

Hi I am able to add record but not able to delete record. It gives the following error: [ERROR] 2010-02-20 13:38:16 (JDBCExceptionReporter.java:logExceptions:78) ORA-02292: integrity constraint (BANKNET.FK_DDA_DEAL_ADVISOR) violated - child record found [ERROR] 2010-02-20 13:38:16 (AbstractFlushingEventListener.java:performExecutions:3...

syntax for using decode in hibernate native-sql

hi when i try to execute the query SELECT DISTINCT DECODE (pd.pr_l50_nm , 'ADVISORY', 'Advisory' , 'EQUITY', 'Equity' , 'DEBT', DECODE (pd.pr_cd, 'BOND-HY', 'Leveraged Finance', 'Debt') , 'LOANS', DECODE (pd.pr_cd, 'IG', 'Loan', 'Leveraged Finance')) EXCO_PRODUCT_NM FROM ibk_dw.PRODUCT_DIM pd WHERE pd.pr_hcy_nm = 'STANDARD' AND ...

Hibernate MS SQL Join issue

Hi folks, I have two tables in the clients mssql database. The first is a job table - so I created an Job entity which contains the load type and load weight and all that stuff - works fine. My problem now is that there is a second table that includes informations about the load and unload point. The second table, I call it JEP, has a...

object references an unsaved transient instance - save the transient instance before flushing

I receive following error when i save the object using hibernate object references an unsaved transient instance - save the transient instance before flushing Can you help me ? ...