hibernate

hibernate query problem, so close and stumped...

The schema: (psuedocode) I have a bean, called BaseEntity... @Entity class BaseEntity { @OneToMany @CascadeType.ALL List [Property] properties; //the use angled braces ommited for the stackoverflow editor to show up properly } Property is another bean... @Entity class Property { @ManyToOne Category category; @OneToO...

hibernate not using where clause with inner join

Here's an excerpt from my code (I'm using XDoclet): /** * @hibernate.class table="WIP_DISCRETE_JOBS" */ public class WipDiscreteJob extends AuditedObject { private WipDiscreteJobStatus status; /** * @hibernate.many-to-one column="STATUS_TYPE" */ public WipDiscreteJobStatus getStatus() { return status; } } /** * ...

Hibernate polymorphism

Good day. This is a Hibnerate polymorphism question and a data model design question; they are intertwingled. I've used Hibernate in the past, and have enjoyed it, but sometimes I find it difficult to think about anything but trivial designs. Not a knock on Hibernate; just an observation that ORM in general can be challenging. I thin...

Why doesn't interceptor's onLoad() work?

We have a jboss based system persistance.xml looks like a following: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/p...

Hibernate search problem - could not initialize proxy - no Session

Hi All, I have the following exception when adding a new record using hibernate. I am also using Hibernate search to create index. This is my exception. Jun 11, 2009 1:01:23 PM org.hibernate.LazyInitializationException <init> SEVERE: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not init...

Has anyone successfully created a project using Tapestry, Hibernate and Spring for jax-ws web services?

I have a project using these technologies and I'm getting a number of issues. The first is this error:- org.apache.tapestry5.ioc.internal.util.TapestryException: Exception constructing service 'ValueEncoderSource': Error invoking service builder method org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, Invalidatio...

Find concrete class using a dynamic expression (where a Class instance is passed to a DAO)

I have this method signature: public int nrOfEntities(Class<? extends MailConfirmation> clazz, User user, String email) I would like nrOfEntities to return the number of entities that: Are of the concrete class clazz Have a matching User if user != null Have a matching email if user == null It's the class matching I'm having a pro...

Using HQL to query on a date while ignoring the time on Oracle

I have a table (in Oracle 9 and up) where I need to find all entries for a given day using Hibernate. The entries have timestamps (with data type 'date'). Some of the entries have a time, others only have a date. This can not be changed, as this is the output of other applications which I can not change. In SQL I would write something al...

Controlling Jboss rollback after Hibernate exception

HI All, I am trying to save name, address, email information using Hibernate...sometimes there is an exception thrown by Hibernate, this causes JBoss to rollback the full transaction! I do not want this to happen, if there is a Hibernate exception while saving email... then I just want the email bit to rollback not the entire, name, add...

Best way to design database tables with interbase?

I am about to start redoing a company database in a proper fashion. Our current database is a mess and has little to no documentation. I was wondering what people recommend to use when designing an Interbase database? Is there some sort of good visual schema designer that will generate the SQL? Is it better to do it all by hand? Basica...

Hibernate polymorphic query

I have two classes, Person and Company, derived from another class Contact. They are represented as polymorphically in two tables (Person and Company). The simplified classes look like this: public abstract class Contact { Integer id; public abstract String getDisplayName(); } public class Person extends Contact { String fi...

DetachedCriteria and jax-ws

Is there a way to pass a DetachedCriteria object to a jax-ws service? (my problem is that DetachedCriteria does not have a no-arg constructor, which is required by jax-ws) ...

JPA native query for LONGTEXT field in a MySQL view results in error

Hi, I have the following JPA SqlResultSetMapping: @SqlResultSetMappings({ @SqlResultSetMapping(name="GroupParticipantDTO", columns={ @ColumnResult(name="gpId"), @ColumnResult(name="gpRole"), // @ColumnResult(name="gpRemarks") } ) Which is used like this: StringBuilder sbQuer...

How to construct a hibernate query that uses a single element of all elements in a collection?

Here's the situation: I have a datatype C that has a one-to-many reference to Datatype P. Datatype P has an optional R reference (one to one). My attempted query was as follows (it was a count, but it will also be used to pull data) FROM C WHERE ... AND P.R.rProperty LIKE 'BLAH%'; I get a org.hibernate.QueryException: illegal atte...

BeforeClass using Spring transactional tests

I'm using the Spring transactional test classes to do unit testing of my DAO code. What I want to do is create my database once, before all the tests run. I have a @BeforeClass annotated method but that runs before Spring loads up the application context and configures the jdbcTemplate, thus I don't actually have a connection to the DB ...

hibernate mapping for postgresql "timestamp without time zone"?

I'm trying to map java.util.Date to postgresql timestamp without time zone type. I'm using a custom sql-insert statement (because the table is partitioned and postgresql won't return number of rows updated on a normal insert), and I keep getting an error saying the function does not exist. I suspect this is due to a problem mapping the...

Hibernate and optimistic locking

I am new to hibernate just to mention but I know that it has optimistic locking support. I was searching all day and I wasn't able to find tutorial how to implement it in some basic application. So fore example I have this mysql table http://pastebin.com/m574200ce and I have this hibernate mapping file: http://pastebin.com/m2047dd98 (g...

Going from PHP Propel to Java Hibernate

Hi all! First post here... I normally develop using PHP and Symfony with Propel and ActionScript 3 (Flex 3), using AMF services. This weekend I'm trying my hand at creating a BlazeDS application using Java and Hibernate, and I'm beginning to like Java a lot!!! After some research this weekend and using the Hibernate Synchronizer plugin...

Hibernate updating problems

when i call update in hibernate i get folloune error A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.psl.cms.DAO.Course.prerequisite i have one class called course which has a set of prerequiste where prequsite is another class when i try to update my course object i get that e...

Rolling back foreign key relationships with Hibernate

What is the Hibernate best practice when having to roll back foreign key relationships, but not wanting to throw out the transaction (ie. still proceed with saving other data)? If I just pass the exception back up the stack or don't do this rollback, then I will hit an error when I do try to save the other data (Null or Transient Object...