hibernate

Log4j - org.hibernate.type doesn't work!

This is my logger configuration: log4j.logger.org.hibernate.SQL=TRACE, stdout log4j.logger.org.hibernate.type=TRACE, stdout but I don't see type bingings So I tried this log4j.logger.org.hibernate=TRACE, stdout to see if I missed something (this shows all hibernate loggers) and I found out that the org.hibernate.engine.QueryParame...

"cascading" a hibernate entity listener?

Hi, Using hibernate 3.2.4.sp1 I have two entities User and ContactInfo A User has a related ContactInfo, relation is unidirectional, i.e. ContactInfo has no idea about the user it belongs to (nor should it as it is reused in other relations) The User entity has an entity listener preventing other users than the actual user itself t...

Hibernate, instrumentation and delete cascade order

I have a complex object graph with JPA connected entities. When I delete the parent the deletions cascade correctly to the children. Then I instrument the parent class (as to not load eagerly one-to-one relationships) and upon deletion I get referential integrity violation exceptions. Looking at the queries hibernate issues upon flush,...

Hibernate: Transaction not successfully started (Threaded webapp) Problem!!

Hello Everyone, I am having this serious problem in a web-app that is using a thread to listen on a port for packets and process those packets. Processing of a packet involves database transactions, so basically it is like : Thread: run () { try { ... fireMessageEvent(data); ... } catch (Exception e) { } } fireMe...

Is cayenne good choice for my requirement?

We are evaluating ORM solutions for my project that has tight coupling between business layer and datalayer(JDBC). I started doing a PoC with Cayenne. My requirement goes like this a) Already there exists database schema b) Schema is very granular level. I.e. real time java objects are only derived by combining tables. c) At the moment I...

Updating JPA-Hibernate entity without selecting it from database

I have a hibernate entity called Execution. It is created in the beginning of my process and updated at end, indicating how it has finished. I would like to update a single property of this entity, without causing a select in my database. Execution execution = entityManager.getReference(Execution.class, executionId); execution.setSta...

Hibernate casts BigDecimal instead of Integer

Hi there, I don't know why but hibernate tries to cast BigDecimal to one of my columns. This column is definied as Decimal(3,0) in my DB2 DB. So there can't be a BigDecimal. hbm.xml <composite-id name="Id" class="db2.P5Id"> .... <key-property name="land" type="int"> <column name="PFIELD1" precision="3"/> </key-pro...

Hibernate: Many-to-one using Formula

Hi everybody, I hope someone can help me find an answer. I'm working with a legacy database and I can't change any of the preexisting tables, because other apps depend on them. I have three main existing tables: A,B,C. A has a column with reference to B(many to one relation). The problem is that it should have a relation to C not to B...

Hibernate Map Mapping Problem

Hi I am trying to Persist a Map in Hibernate as follows: public class Product{ @OneToMany @MapKey(name="id") private Map<Company,ProductCompany> productCompanies=new HashMap<Company,ProductCompany>(); } public class Company{ private int id; } public class ProductCompany(){ @ManyToOne private Product product; @ManyToOne p...

How can I turn off the majority of hbm2ddl's output in the console in Ant?

By default, hbm2ddl spits a ton of output to the console when executing the ant task. I'd like to turn this completely off and simply look at the schema file if something has gone wrong. Anyone know how to do that? ...

Full Hibernate Plugin and Struts2 validation

I did all the validations for my actions and when i start tesing no testing was being performed. I figured out FullHibernate Plugin xml doesn't have the validation interceptor, but defining an interceptor stack with basicStack, hibernateSessionInterceptor and validation interceptors doesn't fix the problem. Thanks a lot. ...

HIbernate FetchMode Join

I have a Parent class with a List of children. I would like to load the Parent by something other than the id e.g. by name...I am using criteria.setFetchMode("children",FetchMode.JOIN); and criteria.add(Restrictions.eq("name", name)) to eagerly load all the data for the parent with a unique name. Problem is I get back thousands of result...

Obtaining a new session from Hibernate for a background thread.

I'm working on a web application. Usually at the beginning of a request (through the architecture code), a Hibernate session is opened to work with DB transactions. At the end of the request the session is closed. This works great for all of our transactions, except that in one particular instance, I want to fire a thread from a request....

Seam Custom Validation

Hi, I'm trying to implement a custom validation annotation in Seam. We have a list of objects, lets call it arrayA, and arrayA is different dependent on today's date. Next we have an input field stringB, stringB is some value in arrayA going through a transformation function funcC(...). So basically, we can validate stringB using th...

"correct" way to select next sequence value in HSQLDB 2.0.0-rc8

suppose i have a sequence, called TEST_SEQ what would be the correct way of selecting its next value ? this does not work: select next value for TEST_SEQ probably because it expects a "FROM" clause. looking at HSQLDialect.getSequenceNextValString() in hibernate i see this: "select next value for " + sequenceName + " from dual_" + sequ...

With Hibernate, an Interceptor receives the same collection object as current and previous, how do I get real current and previous values?

I have an Interceptor for a Hibernate managed object. The File and Customer tables have an intermediate table (FileCustomer) which represents a many to many relationship between the two. This is managed in Hibernate by the File class. @OneToMany(mappedBy = "file", cascade = { CascadeType.ALL }, fetch = FetchType.EAGER) @Cascade(org.hibe...

How to share EntityManagerFactory Object across the various Resource files in a Restlet application?

I would like to create one EMF object and use it in various Resource class objects.. any ideas on how to do this? ...

HQL Query with where clause

Hi guys; I am trying to query hibernate for given scenario: My Data Model Class Communication: variables : subject, sentTo, creator. Now lets say there are some notes exchanged between usera and userb. I want to find all those notes by a hibernate query. I have written below my query string. select note from Communication n where n...

jpaTamplate how to autocommit...?

I am using JPA i have setup transaction on service layer using @Transactional.. it is working fine.. but when i test Dao (Junit) transactions using JpaTemplate are not getting commited.. although same test with JdbcTemplate were getting comitted... So how to enable auto-commit for JpaTemplate...? ...

Glassfish ThreadDeath issue on redploy with Spring MVC and hibernate

I have a spring MVC application that is deployed on a glassfish server. During execution of this application I get a ThreadDeath exception. The exception occurs on the first form submission of the application (which involves a query to a DB using hibernate). The error goes away if I restart the application server. I shouldn't have to res...