hibernate

CF9 ORM mapping issue DB error

I am trying to map some ORM entities and properties and what should seem right, I get the following SQL error: java.sql.SQLException: Error on rename of './reflexgym/user' to './reflexgym/#sql2-36b-30' (errno: 152) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLErro...

ManyToMany assoicate delete join table entry

I use these two entities to create a new user and groups it associates: @Entity @Table(name="usertable") @SuppressWarnings("serial") @Searchable public class User implements Serializable { @GeneratedValue(generator="userIdSeq") @SequenceGenerator(name="userIdSeq", sequenceName="usertable_id_seq") @Searcha...

Hibernate: How can I create saved filters and then use them?

This is the problem: I receive a task for a project which uses Spring, Hibernate and Wicket. In a particular HTML page I must have the possibility to create a filter (set the name of the filter and its parameters). I must create a list of filters in this way. In the same time, I must have the possibility to edit a...

Maintaining graph consistency in relationships with nHibernate

If I use bidirectional associations in nHibernate, is it necessary for me to add my own code to both sides of the relationship to automatically update the other side? For example, if I have a Many-to-One relationship between Book and Category public class Book{ public Category Category{ get; set; } } public class Category{ pub...

Trying to destroy beans in the correct order with Spring

Hi, I've got a web app with Spring set up to create my hibernate session factory (singleton) and session and transaction (both are request scoped), but it is destroying the session and transaction in the wrong order. How can i configure it so that the transaction is destroyed before the session? Here's my spring applicationContext.xml fi...

Is it possible to load an object, it transient state from the get go?

When querying for a object by id or returning a list of objects using Hibernate, is it possible to tell hibernate to retrieve the object(s) in transient state. I don't want to track any changes at all, this is a read only type query and speed is of essence. ...

How to configure maven hbm2hbmxml and hbm2java to run one after the other in mvn clean install

Hi, I need to be able to call mvn clean install and have maven call hibernate3:hbm2hbmxml to generate the mapping files from a database and after than call hbm2java to get the Java files and then have maven compile those newly created Java files. Has anyone done this before? Thanks ...

Unable to delete entity with complex parent-child relationships

I have the following relationships in my entity table Table A @OneToMany(mappedBy = "A", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @Cascade(value = DELETE_ORPHAN) @OrderBy private List<B> orders = new ArrayList<B>(0); @OneToMany(mappedBy = "A", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @Cascade(value = DELETE_ORPHAN)...

registerHibernateType in Hibernate

What is registerHibernateType and how to use it? ...

How to get rid of LazyInitializationException with Wicket JPA/Hibernate integration (with Spring)

Hi, i'm developing an application using Wicket as the view layer and JPA(Hibernate) as ORM. building the UI has been fun (even with ajax) using Wicket. My problem comes from integrating the persistent objects on edit pages (readonly pages are no problem using a LoadadableDetachableModel). I'm using the OSIV filter from spring to provide...

intermediate Table with EmbeddedId causes StackOverflow

Hello there! I have a problem with my hibernate mapping using EmbeddedId. My code looks like these: Inventory: public class Inventory { private Long id; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "inventory_id") public Long getId() { return id; } public void setId(Long id) { this.id = id; } private ...

GWT app and Hibernate under Eclipse

Hello I have a GWT app created by GWT wizard under Eclipse. I also created a separate project (called Model) in the workspace where I put Hibernate classes and mapping hbm.xml files. Now I'd like to properly reference this project from my GWT project so that Hibernate configuration can successfuully load classes and mapping files from G...

Recipe for upgrading JBoss 5.x Hibernate to 3.5.x?

Hello; I'd like to upgrade the Hibernate installation that ships as part of JBoss 5.1.x to Hibernate 3.5.x. Is there an "approved" recipe for doing this? ...

Mapping result of a native SQL query to Grails domain class

Hi Is it possible to map the result of a native SQL query to a collection of Grails domain class instances? ...

Best way to update some fields of a detached object on Hibernate?

Hi All, I was wondering what's the best way to update some fields of a dettached object using HB on Java. Specially when the object has child objects attributes. For Example (annotations removed and fields number reduced to reduce noise): public class Parent { int id; String field2; ... Child child; } public class Child { ...

Save blob to DB using hibernate

Hey! I tried save file to MySQL using blob with hibernate3. But I always have java.lang.UnsupportedOperationException: Blob may not be manipulated from creating session org.hibernate.lob.BlobImpl.excep(BlobImpl.java:127) Here some code. package com.uni.domain; public class File extends Identifier { private byte[] data; priv...

Hibernate: Check if object exists/changed

Assuming I have an object Person with long id String firstName String lastName String address Then I'm generating a Person-object somewhere in my application. Now I'd like to check if the person exists in the database (= firstname/lastname-combination is in the database). If not => insert it. If yes, check, if the address is the same....

Is it possible to generate Annotated Java classes using Mojo's Hibernate plug-in?

I know that hbm2hbmxml generates the necessary mapping files (*.hbm.xml) from a given datasource. You can then use hbm2java which will use those hbm.xml files as an input and will output Java classes. Is there a way of generating Java Annotated classes from the datasource without having to rely on the hbm.xml files? Thanks. ...

Hiberate save-update listener and ascertaining field changes

Good day. I've implemented a Hibernate save-update listener by extending org.hibernate.event.def.DefaultSaveOrUpdateEventListener.DefaultSaveOrUpdateEventListener and overriding onSaveOrUpdate(SaveOrUpdateEvent e). @Override public void onSaveOrUpdate(SaveOrUpdateEvent evt) throws HibernateException { super.onSaveOrUpdate(evt); ...

Hibernate inheritance search

Hello guys! I will try to summarize my question. I have a base class "Base" with three properties. Four classes inherit from it - "A", "B", "C" and "D". They add their own additional properties. I have mapped this with InheritanceType.JOINED. Now I want to search for "Base" entities, which means that I search on the common properties ...