hibernate

StaleObjectstateException row was updated or deleted by ...

I am getting this exception in a controller of a web application based on spring framework using hibernate. I have tried many ways to counter this but could not resolve it. In the controller's method, handleRequestInternal, there are calls made to the database mainly for 'read', unless its a submit action. I have been using, Spring's S...

Problem using Hibernate and SQL Server 2008

I'm having problems using Hibernate and SQL Server 2008. When I try to save an object to database Hibernate throws this: could not retrieve snapshot: com.my.MyClass Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name `'emanagement.patient_visit'.` The user has select, insert,update privileges in database. ...

GlassFishV3 Hibernate library issue

Hi, I am trying to deploy a JAR file in a GlassFishv3 server. This results in the error: com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while preparing the app : java.lang.RuntimeException: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence I thought that the class "org.hibernate.ej...

Help with HQL Joins

I have the following SQL which I can't work out how to convert to HQL.... SELECT dbo.Style.Id, dbo.Style.Name FROM dbo.Price JOIN dbo.PriceGroup ON dbo.Price.priceGroupId = dbo.PriceGroup.Id JOIN dbo.Product ON dbo.Price.productId = dbo.Product.Id JOIN dbo.Style ON dbo.PriceGroup.Id = dbo.Style.priceGroupId WHERE (dbo.Produc...

I am using jsf, hibernate and Spring in my project and now i need to implement JBPM(JBOSS)

hello I am using jsf 2.0, hibernate and Spring in my project and now i need to implement JBPM(JBOSS) and totally i am new to jbpm and using glassfish server so how can i add this stuff... ...

Uniqueness within Bag in Hibernate

Hi, I have a hibernate mapping where I am creating a join table using the <bag> tags. How do I ensure uniqueness of the combination of keys that go into the join table ? Sample here: <bag name="PersonStuffs" table="person_x_stuff" cascade="none" > <key column="person_id" not-null="true" /> <many-to-many class="com.sample.Person"...

Large Objects may not be used in auto-commit mode

Hello, I have a Spring application which uses Hibernate on a PostgreSQL database. I'm trying to store files in a table of the database. It seems it stores the row with the file (I just use persist method on EntityManager), but when the object is loaded from the database I get the following exception: org.postgresql.util.PSQLException: ...

Programatically setting the db url/user/password in Hibernate

I need to centralize all settings for our Java web application in one .properties file. I can still have hibernate.cfg.xml for adding mappings to entity classes but I need to keep all of our settings for the database and custom paths in one .properties file. Originally I kept my configs in hibernate.cfg.xml as follows.... <?xml vers...

Can I name my constraints with JPA?

When I use the maven-hibernate3-plugin (aka hbm2ddl) to generate my database schema, it creates many database constraints with terrifically hard-to-remember constraint names like FK7770538AEE7BC70 . Is there any way to provide a more useful name such as FOO_FK_BAR_ID ? If so, it would make it a tad easier to track down issues in the lo...

direct access to ehcache and only use hibernate on a cache miss

Env: Seam 2.2.0, JPA, Hibernate 3.3.x, ehcache-core 2.0.1 Here are some observations on using a cache along with Hibernate. We are already using the 2nd level cache but not quite comfortable with the response times. The third option mentioned in the above reference (Direct access to EHCache, only use Hibernate on a cache miss: 20 secon...

Can you use ehcache 2.1.0 with Hibernate 3.3.x

ehcache-core-2.1.0.jar seems to have the following dependency, does it imply I cannot use this with hibernnate-core-3.3.x.jars <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.5.1-Final</version> <scope>provided</scope> </dependency> ...

How to map custom collection in JPA?

Hello everybody! I have problems in mapping custom collection with JPA (Hiberante provider). For example when I am using object with attribute List<Match> matches; with <one-to-many name="matches"> <cascade> <cascade-all /> </cascade> </one-to-many> in my ORM file, it is allright; But if I replace "List matches;" ...

How to manage association entities in Hibernate / BlazeDS

I'Ive been working on Java/Hibernate/BlazeDS integrations - but am getting stuck with sending the child entities in a one-to-many relationship across BlazeDS... For starters I have a Client and ClientLinks table in MS Sql Server Now java-side in Client the property defining the ClientLinks entity is private Set clientLinks = new HashS...

Superkey consists of three attributes - how to cope with Hibernate?

Consider a relation with a candidate key of three attributes: I was wondering if someone could give me an example of a config file for Hibernate? ...

Object query language | execute both "order by" and "where" clauses

How do I sort out some data according to an where clause and a order by clause using object query language this is the query that I'm using but i'm not sure if it is working or not. SELECT user from user.User as user WHERE user.status=1 order by user.username Thanks. ...

Hibernate+Oracle+Clob: Content of attributes get switched.

Has anyone heard of this error before: I have a Java 5 application, that uses Hibernate 3.3.2 to access an Oracle Database 10g, the JDBC driver is the Oracle light driver version 10.2.0.4.0 (the most recent version, I think). The database access happens during a transaction that is managed via the AOP-tools of spring. There is one datab...

cache provider for hibernate + jsf + spring

Which cache provider is suggested for an application that uses Hibernate3 Spring JSF2 ...

Hibernate @ManyToOne on inconsistent database

Hi All, Let's say I have two tables, employee and department where emp has a @ManyToOne key to dept. Now I want to be able to delete rows from the dept table but keep the emp records pointing to it; basically saving the relationship so that when the dept table is recreated the relationship is restored. (This actually happens in our syst...

Hibernate property name capitalisation issue

Hi all, I have a problem with how hibernate/JavaBeans constructs property names. Here's my property. private boolean aNumberFl; @Column( name = "aNumberFl", nullable = false ) @Type( type = "yes_no" ) public boolean getANumberFl() { return aNumberFl; } public void setANumberFl( boolean var ) { this.aNumberFl = var; } Every...

Hot to turn off hbm2ddl?

I couldn't find a reference on how to switch hbm2ddl off. ...