hibernate

Seam cache provider with ehcache null

Hi every one, I'm trying to configure seam/ehcache following the tutorial from jboss page: http://docs.jboss.org/seam/2.1.2/reference/en-US/html/cache.html I put the ehcache.1.2.3.jar in project.ear/lib and injected CacheProvider as especified, but the CacheProvider always return null. The documentation doesn't show any aditional conf...

OneToOne Mapping with hibernate/JBoss/Seam

Hello, I want to create a one to one mapping between the Entity Customer and OptIn. The OptIn Entity is optional. That is why the foreign key must be in OptIn. At deployment I get the following error because the mapping can not be found: OneToOneSecondPass.java:135 Values: otherSide= optIn, mappedBy=customer otherSideProperty = Bi...

equals and hashcode in Hibernate

How should model class's equals and hashcode be implemented in Hibernate? What are the common pitfalls? Is the default implementation good enough for most cases? Is there any sense to use business keys? It seems to me that it's pretty hard to get it right to work in every situation, when lazy fetching, id generation, proxy, etc are take...

Is it possible to bind a whole class in spring?

Hi,I use spring web flow 2 with hibernate annotations. Is there possible that in my jsp using form tags to bind a whole class? I am asking this, because when I generated my entity classes from SQL Server 2008 using Intellij it autogenerated also my @ManyToOne column (it's about 2 tables: one named Leader-with idLeader,name..and so on and...

change notification on domain objects (Hibernate/Java)

Is there a solution available to subscribe for domain object changes for Hibernate or any other mainstream O/R mapping framework? For example if I have a table in a database called "Apple" I'd like to be able to say "notify me when any Apple object changed" or "notify me when field "colour" of any Apple object changed". Of course I'd exp...

Hibernate on hypersonic in production?

Developers of hypersonic promise increase of performance? But I'm afraid problems with administrating and other aspects of using hsqlDB. Are anybody using this in production? Is it good idea? ...

@SecondaryTable annotation problem

I have following model, @Entity @Table(name = "user") @PrimaryKeyJoinColumn(name="user_id") @SecondaryTables({ @SecondaryTable(name = "user_personal_details", pkJoinColumns = {@PrimaryKeyJoinColumn(name = "user_id", referencedColumnName = "user_id")}), @SecondaryTable(name = "user_address", pkJoinColumns = {@PrimaryKeyJoinColumn(name =...

Hibernate on Oracle: mapping String property to CLOB column

WARNING: see my own answer below. The problem is caused by old Oracle drivers that were present on the classpath in addition to 10.2.0.4. Problem solved. Leaving the rest of this question for posterity. I've been banging my head against the following. Here's a simple POJO distilled from my application code: @Entity @Table(name = "PIGGI...

Hibernate CollectionOfElements doesn't auto create table in SQL server

Hi, Using auto update (hibernate.hbm2ddl.auto=update) I have a entity which is supppose to create two tables: myentity and myentityconfigurationProperties. This works fine in Mysql 5, but in SQL server 2005 it doesnt create the property table. Anyone knows anything about this? I havn't tried creating the table myself, I'd like to avoid ...

Help With TreeCache (Jboss Cache) configuration for 2 entity manager

Hi guys, I'm in a big trouble at moment. I need to configure a cluster cache for my seam application, but i'm having problem beacuse i have 2 entity managers, one for oracle and other one for mysql. If i remove mysql persistence-unit and entity manager, everything works fine, but when it is active the following error is displayed: org...

Fetching join using @JoinTable with SQLQuery

I have a mapped entity with a property "latestHistory", which is mapped through a join table, like: class Record { @OneToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY, optional = true) @JoinTable(name = "latest_history_join_view", joinColumns = { @JoinColumn(name = "record_id")...

mapping a postgres array with hibernate

has anyone successfully mapped a numeric array in postgres to a numeric array in java via hibernate? sql: CREATE TABLE sal_emp (name text, pay_by_quarter integer[]); INSERT INTO sal_emp VALUES ('one', '{1,2,3}'); INSERT INTO sal_emp VALUES ('two', '{4,5,6}'); INSERT INTO sal_emp VALUES ('three', '{2,4,6}'); mapping: <hibernate-ma...

Does HibernateTemplate work with Envers? If so, how?

I am trying to use Envers on a project that also uses Hibernate and Spring - and I appreciate a lot the code reduction offered by HibernateTemplate. I configured Envers under JPA, and after a few tweaks I was able to have the schema generated by the EnversHibernateToolTask Ant task (including the auditing tables). However, when I write ...

Help with Hibernate Collection Foreign Key Mapping

Hi, I'm running into significant difficulty getting my mapping file to work with a collection of elements via a foreign key in Hibernate. Java will try to load these files below and won't have any runtime exceptions, but the events table is never loaded as an object of an employee (it will remain null, but every other attribute loads fr...

Hibernate detached queries as a part of the criteria query

Hi Hibernate, java experts can you please help me write detached queries as a part of the criteria query for the following SQL statement. select A.* FROM AETABLE A where not exists ( select entryid FROM AETABLE B where B.classpk = A.classpk and B.userid = A.userid and B.modifiedDate > A.modifiedDate ) and userid = 10...

Hibernate updating database structure with new indexes

Hi All. It's well known fact that hibernate work with indexes in a very strange way. It generate them only if you create a database schema from the scratch. But if you try to update the database schema hibernate will ignore new indexes. My question is, does anybody find a solution how to ask hibernate generate SQL for new indexes durin...

Deleting of related objects in hibernate

Hi all, I have a hibernate model with two classes, let's say A and B. B has a many-to-one reference to A. I query a single A and a single B object. These are detached from the Session and they get processed somewhere/used else. The B.A property is a lazy proxy. Sometime later A and B both need to be deleted. I create a new Session...

How to use join in hibernate criteria following situation

Hello, We have two tables Family and Member, the relation between these two is Family has set of members in it but member don't have any family relationship within it. I wanted get member using dob and family for that I am using Hibernate criteria API's but I am not getting how to write join query since members don't have Family insta...

hibernate c3p0 broken pipe

Hi, I'm using hibernate 3 with c3p0 for a program which constantly extracts data from some source and writes it to a database. Now the problem is, that the database might become unavailable for some reasons (in the simplest case: i simply shut it down). If anything is about to be written to the database there should not be any exceptio...

spring+hibernate mapping class without xml

in my applicationContext.xml, this is how I map xml to POJO. how to map directory to class file without required to create xml? <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="mappingResources"> <list> <value>com/custompackage/custom/spi/hibernate...