hibernate

hibernate: Is this mapping allowed?

@Entity public class A { @Column(name="Foos") @Basic private HashSet<Foo> fooList = new HashSet<Foo>(); } where class Foo is nothing special, just implements Serializable. Essentially I want to Serialize the whole HashSet to the database. This mapping works ok to persist, however when I try to load it I receive a ClassNotF...

JPA + Hibernate + autocommit

Does anybody know why I get this warning when I turn off the auto-commit in JPA configuration file? Using this setting : <property name="hibernate.connection.autocommit" value="false"/> generates this warning : 2009-08-04 09:54:10,621 [main] WARN org.hibernate.ejb.Ejb3Configuration - hibernate.connection.autocommit = false break the...

Spring Open JPA

Hi, I am trying to integrate Spring and OpenJpa. For every scenario the exception thrown is SAXParseException: No Content allowed in Prolog. I am aware that the issue is probably related to the xml files but all the related xmls are read and validated correctly. The spring files are parsed correctly and beans are created but the en...

Configuring EhCache on JBoss

Ok this is driving me crazy.... Server: JBoss 4.0.5 I have my hibernate-service.xml where I include the: <attribute name="CacheProviderClass"> org.hibernate.cache.EhCacheProvider </attribute> Which seems to work fine in terms of loading and getting the ehcache started, but I do see this pesky message about: WARNING: No conf...

How can I use Maven to get the latest Hibernate release?

I am having trouble getting the latest release of Hibernate via Maven dependency. It appears that the latest I can fetch from a Maven central repository is 3.2.6.GA, and I am interested in using 3.3.2.GA, which is the latest release shown on the hibernate.org site. When I modify my hibernate dependency to this latest version in my proj...

How Do I Retrieve The Class Name From Hibernate?

If there's already a question that addresses this, then could I please get a link as I cannot find one. I'm looking to obtain the stored class name of an object stored in my Hibernate database. When I look at the database externally I see the strings stored that have the classname. How can I retrieve the class name without constructing ...

testing hibernate parent/child relationship

hello good fellas! i use spring and hibernate for my data access layer i'll like to have some guidance about how to construct my unit testing to test if hibernate is effectively insert in the child table(parent hibernate mapping has the cascade all on the set). For what i know i shouldn't mix dao's unit testing.So supposing the i'm testi...

Validating that all JDBC calls happen within a transaction

How can I validate that all JDBC access happens on an active transaction, i.e. java.sql.Connection.getAutoCommit() always return false? I'm using Spring for transaction management ( @Transactional ) and Hibernate for data access. Update: What happens is that some Hibernate access is performed without the service method being annotate...

Hibernate 'tableless' enum mapping?

I am dealing with the following scenario: We use table-per-subclass inheritance, meaning the concrete tables' primary keys are foreign key references on the abstract table. Superclass is Product, subclasses are Book, DVD, AudioCD, ... Now in the Java superclass, say Product.java, we have an enum of the types of products: book, dvd, mu...

Hibernate: bad performance when removing element from many-to-many relation.

I have to Classes (UserSet and User) which have a many-to-many relation (i.e. every user can belong to some UserSets). In the database there is a UserSet Table, a User Table and an 'in between' Table (UsersToUserSets). Now, if I want to remove a user from a UserSet by doing userSet.getUsers().remove(user); session.flush() Hibernate ...

hibernate many-to-one hql query, when inner join fetch property not associated

I have a many-to-one association set up like this, in the hbm.xml: <many-to-one name="gigVenue" class="blah.blah.xxx" fetch="select" lazy="no-proxy" not-null="true" > <column name="N_VENUE_ID" precision="18" scale="0" not-null="true" /> </many-to-one> And I am using instrumentation to do true lazy loading. BUT when I run a hql query ...

Spring 2 Hibernate Annotation

Hi Gurus, I am setting up Hibernate Annotation (User JPA for mapping) with Spring. (i.e. AnnotationSessionFactoryBean) I have a few questions Do I need a hibernate.cfg.xml for mapping? From the example http://www.zabada.com/tutorials/hibernate-and-jpa-with-spring-example.php, it seems you need to do AOP, do you really need that? I sa...

Checking if a duplicate Child Object already exists db when pushing Graph

Hi all, Considering Hibernate 3, I have a parent table, and a child table, linked by a foreign key. I declare a many-to-one association into parent hbm file with a cascade all property. I first persit a parent (save or persist) and it saves a parent and a child. Fine so far. But in another session, i create a new parent object (functi...

How to deploy jBPM 3.2.2 console on Oracle 10g iAS

Hi! Does anybody have experience regarding deployment of the jBPM Administration Console on Oracle 10g iAS? I successfully deployed it using an .ear, security mappings working, I can even login to the console, Hibernate finds the JNDI datasource but it cannot find the TransactionManager. I see no log, only the exception thrown in the...

Clone a Table's definition with Hibernate (hbm2ddl)

In my hibernate application there is annotation driven object: AuditEvent. Its very simple and has no foreign key relationships. I archive old entries in this table by moving them to another table OldAuditEvent, which is a clone of the AuditEvent table. Right now we generate the DDL for the entire application using hbm2ddl (on our a...

How do you do a limit query in HQL

In Hibernate 3, is there a way to do the equivalent of the following MySql limit in HQL. select * from a_table order by a_table_column desc limit 0, 20; I don't want to use setMaxResults if possible. This definitely was possible in the older version of Hibernate/HQL, but seems to have disappeared. ...

Hibernate cannot remove child from database

Here is my situation: I load an object that contains a bi-directional parent child relationship into my database. Later, that object is loaded into my UI where changes can be made, including deleting any number of children from the child set. This modified copy of my object is then loaded using the saveOrUpdate method. However, when this...

Two approaches of task distribution in a multi tier application

I am working on a large web application in Java using Spring and Hibernate as the persistence solution. And as for the methodology, we're on Scrum. My role is that of a Scrum Master. I am also the one managing the business requirements and overall direction of the application. While dividing the requested features into tasks, we have tw...

With Hibernate, can I mix table-per-subclass and a <map> within the same table?

I'm attempting to map an object model for "Promotions"; i.e., a customer enters a promo code during signup. Different promo codes might have different types of "benefits", meaning what we are giving to the customer. For example: promo code XYZ123 will give the customer free minutes in his or her account, while a different promo code w...

Hibernate one to many using something other than a primary key

I have a class A that has a set of B's. However, these two objects are linked by fields that are NOT the primary key. For B, I can use , but how do I specify that the join should be in A.secondary_column, Not A. table_primary_key_id ? <class table="a"> < id column="table_primary_key_id" > < /id> <property column="secondary...