hibernate

spring+hibernate+ehcache, how to clear all cache

i'm using 2nd level cache and query cache. may i know how to programatically clear all caches? ...

A typical lifecycle of a Hibernate object in a web app - ?

Describe please a typical lifecycle of a Hibernate object (that maps to a db table) in a web app. Suppose, you create a new instance of an object and persist in the db. But during the app lifetime you'll be working on a detached object and finally you need to update it in the database, for example on exit. How does it look like with hibe...

Hibernate orm for a view

How do you ORM a view? Is there any difference with a table in terms of reverse engineering? In my case, I have a whole pile of joined tables that will be read-only in an application. So, if I need sort of an Object with all collections in proper order, instead of long chains of relationships - collection with another etc, it'll be si...

Unique Constraint Nhibernate.

I have a object with a Nhibernate mapping that has a surrogate ID and a natual ID. Since of cource the natural ID is uniquely constrained a insert query will fail if the object is already in the database with the same natural ID. My solution for this has been to manually check to see if natural IDs are in the database before trying to ...

Avoid implicit conversion from date to timestamp for selects with Oracle using Hibernate

I'm using Hibernate 3.2.7.GA criteria queries to select rows from an Oracle Enterprise Edition 10.2.0.4.0 database, filtering by a timestamp field. The field in question is of type java.util.Date in Java, and DATE in Oracle. It turns out that the field gets mapped to java.sql.Timestamp, and Oracle converts all rows to TIMESTAMP before ...

How to invalidate / refresh a domain instance association?

There is a bug in Grails preventing me from using removeFrom* when the node I'm trying to remove is extending the collection type. Removing the node directly from the association won't update the second level cache. A hasMany B Is there any way to manually invalidate or force a reload on an association cache? Invoking refresh() on...

Tips for resolving Hibernate/JPA EntityNotFoundException

I'm running into a problem with Hibernate where when trying to delete a group of Entities I encounter the following error: javax.persistence.EntityNotFoundException: deleted entity passed to persist: [com.locuslive.odyssey.entity.FreightInvoiceLine#<null>] These are not normally so difficult to track down as they are usually caused by ...

default caching time when using hibernate

when using hibernate 2nd level cache and query cache and not specifying anything inside ehcache.xml .what is the default caching time? ...

Hibernate. How can we set name of PK/FK using annotations?

We have hibernate-based system and customer wants to get human-readable names of PK and FK. In our project we use annotated entity classes. Is it renaming possible? ...

hibernate update JPA foreign key

My jpa looks like below public class TESTClass implements Serializable { ... private String name; @EmbeddedId protected IssTESTPK issTESTPK; @ManyToOne(optional=false) @JoinColumns({ @JoinColumn(name="DIVISION_CODE", referencedColumnName="DIVISION_CODE", nullable=false, insertable=false, updatable=fal...

Turn off Hibernate Logs for certain query

Can you turn off log messages for certain query in Hibernate / EJB 3.0? Is there a way to override the parameter "hibernate.show_sql" for just a single query? ...

Hibernate persist order

Hi there! I have a question about how Hibernate persists entity relations. Let's say I have an entity A that has a relation with entity B and another one with entity C. I create an A instance and populate it with new instances of B and C. When I persist A I need C to be persisted previous to B. Is there any way of doing this? Thanks a l...

Understanding SingleTableEntityPersister n QueryLoader

I have the Hibernate model: @Cache(usage = CacheConcurrencyStrategy.NONE, region = SitesConstants.CACHE_REGION) public class Node extends StatefulEntity implements Inheritable<Node>, Cloneable { private Node _parent; private List<Node> _childNodes; .. } @Cache(usage = CacheConcurrencyStrategy.NONE, region = SitesConstants.CA...

Could not initialize proxy - No Session again

I get these error log when viewing a page ERROR [TP-Processor11] (LazyInitializationException.java:42) - could not initialize proxy - no Session org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132) at org.hib...

Vaadin table hide columns and container customization

Hello I am testing a project, using Vaadin and Hibernate. I am trying to use the HbnContainer class to show data into table. The problem is that I do not want to show all the properties of the two classes in the table. For example: @Entity @Table(name="users") class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long...

How to map oracle timestamp to appropriate java type in hibernate?

I am new to hibernate and I am stumped. In my database I have tables that have a columns of TIMESTAMP(6). I am using Netbeans 6.5.1 and when I generate the hibernate.reveng.xml, hbm.xml files, and pojo files it sets the columns to be of type Serializable. This is not what I expected, nor what I want them to be. I found this post on the...

Spring MVC + Hibernate encoding problem

I work on Spring MVC + Hibernate application, use MySQL (ver. 5.0.51a) with the InnoDB engine. The problem appears when I am sending a form with cyrillic characters. As the result, database contains senseless chars in unknown encoding. All the JSP pages, database (+ tables and fields) created using UTF-8. Hibernate config also contains...

Where can I find a list of Hibernate default configuration settings?

I'm looking for a list of hibernate configuration settings with the defaults listed. I found a good list of settings here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html ...but the default settings are not listed. ...

Persistence provider caller does not implement the EJB3 spec

WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoad er() is null. How do you get rid of the above warning? 0:42:08,032 INFO [PersistenceUnitDeployment] Starting persistence unit pe rsistence.unit:unitName=k12-ear.ear/k12-ejb-1.0.0.jar#k12 10:42:08,3...

How can we change method for generating PK and FK names in hibernate?

Can i provide some algorithm for generate smth intead of FK030HF9840303 for example? ...