hibernate

JPA2.0 support of custom user-types and second level cache

Hi, I'm trying to decide whether to switch from having Hibernate sprinkled all over to using JPA2.0 and thus be provider portable. 1.Does JPA2.0 support custom user-types? 2.I'm on the verge of implementing Terracotta as a second-level cache to Hibernate with its clustering abilities mainly in mind. I would imagine, but I don't actually ...

Hibernate Second Level Cache EhCache library mismatch?

I'm using Hibernate 3.5.0, JBoss AS 6 and Liquibase 1.9.5. I wanted to activate EhCache Hibernate second-level caching as follows: The first thing I do, is adding a new dependency to the pom.xml: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> <version>3.5....

Transaction on postgresql not comitted, mapped objects are not being persisted with autoCommit=false

Mapped objects are not being persisted in DB (Postgresql 8.4) when calling persist in a running transaction. I am using Spring Transaction Management with the org.springframework.jdbc.datasource.DataSourceTransactionManager so everything should be fine. I set the autocommit-mode on the DataSource to "false". When setting the mode ...

Exception when using derived property in HQL

I have an entity with a derived property that maps to an entity with a composite key. Here is my mapping (using annotations) inside SampleEntity: @OneToOne(fetch = FetchType.LAZY) @JoinColumnsOrFormulas({ @JoinColumnOrFormula(formula = @JoinFormula(value = "sql comes here", referencedColumnName = "COLUMN_A")), ...

Is there a way to load an object in Hibernate without writing a query or having an ID?

I can persist an object into the DB from Java as such: Table Person: varchar name varchar groupID varchar emailAddress key on (name, groupID) And in Java Person foo = new Person("dhackner", "3"); session.persist(foo); The two arguments make up the key. In this case, name and groupID are the unique key in the DB, and thu...

How can I serve i18n messages from database effectively

I'm using latest versions of Spring Framework and Hibernate. I know how I can create custom version of MessageSource. But what would be best way to serve i18n messages. Because if I query database every time application needs internationalization, it will cause huge amount traffic to database, and often queries will just return same answ...

How do I cure the cause of Hibernate exception "IllegalArgumentException occurred while calling setter"?

How do I cure the cause of the occasional exception IllegalArgumentException occurred while calling setter that Hibernate throws when my program attempts to load a user by name from the database? Am I incorrectly mapping column USER_RV in table User to class Integer instead of BigDecimal or some other integer type? Note that the same a...

Hibernate returning no results show this error INFO: Not binding factory to JNDI, no JNDI name configured

I am using JPA with hibernate and trying to connect to the a datasource to retrive information but when i run the application i get no error as such but no results are displayed when i run the following code.The question arose from a previous post located here when I was setting up the environment to do some testing of JPA with hibernate...

Is there a library etc that walks joins in property path expression in a Hibernate Restriction property.

It seems irritating that property paths that involve joins must be broken down into multiple criteria. This means that code building a HQL is considerably bloated especially when the path has many joins within it. I have been unable to find a library which "internally" expands paths into the right criteria. ...

Hibernate one to many mapping

Hi, I have two tables: <class name="Content" table="language_content" lazy="false"> <composite-id> <key-property name="contentID" column="contentID"/> <key-property name="languageID" column="languageID"/> </composite-id> <property name="Content" column="Content" /> </class> and <class name...

paging grid in gxt

Im developing the paging grid using GXT 2.1.1, Im retrieving values from database tables using hibernate. My code is `public class ExampleSampleTrip extends Composite { final GreetingServiceAsync service = GWT.create(GreetingService.class); static class BeanModel implements ModelData { @Override public ...

Manage 10,000 users updating database through web application

I have a scenario where more than 100k users trying to update database concurrently through web application in struts ,hibernate . what is the best way to solve this. This application is locally accessed within india bangalore.this site does not always have traffic,but only during sep to dec. around 5k users hit the database. we have...

Disable automatic versioning in Hibernate JPA provider?

Hi, We are in a middle of an migration process of converting EJB2.1 entity beans to EJB3 we have chosen Hibernate as JPA 1.0 provider in Weblogic. We would like to disable auto. increment of entity version when persisting. Is it possible to turn of this feature? (as in property or persistence.xml?) Do JPA 1.0 support pessimistic lo...

Bulk Delete ManyToMany collections on Derby

I'm using Hibernate and Derby. I've this class: public class Sensorboard { //... @ManyToMany(fetch=FetchType.LAZY) @JoinTable(name="SENSORBOARD_SENSORBOARD_JOIN", joinColumns= @JoinColumn(name="SENSORBOARD_ID", referencedColumnName="ID"), inverseJoinColumns= @JoinColumn(name="NEXTSENSO...

joining two tables with differnt join column names

I have two tables A -> B with many-to-one mapping/associations. Table B's primary key is foreign key in table A. The problem is column names in both tables are different. let's say B has primary key column "typeNumId" which is foreign key in table A as "type". How can I join both tables on this column? how can I specify mapping to ind...

Loader constraint violation in hibernate createFullTextQuery

I have a webapplication using Hibernate and Jpa and want to add search via hibernate-search. I use the following hibernate versions: hibernate-core-3.3.2.GA hibernate-annotations-3.4.0.GA hibernate-entitymanager-3.4.0.GA hibernate-search-3.2.1.Final And for lucene: lucene-core-2.9.3 The following code compiles perfectly fine: public Li...

JPA 2 Remote Criteria?

Is there any way that Criteria for qureies can be built on a remote (Swing/SWT etc) client? We've been using the DetachedCriteria functionality in Hibernate for quite some time, but would like to use standard JPA 2. If not, could the code from hibernate be re-factored to create the remote API? Or is this something that might come alon...

Can reference to javax.persistence.EntityManager be cached?

Can we cache reference to EntityManager. As for our requirement, instead of injecting EntityManger into other EJBs, we are having utility class which will return the reference to entitymanager. The issue is each time we need to get reference, we are doing JNDI lookup. in order to avoid JNDI lookup, we want to cache the reference to ent...

JPA support for XML datatype columns

For a new project we are starting (which uses JPA 2 on top of Hibernate 3) we need to be able to store XML documents and then query on their content and structure at a later date. The databases we would like to support are DB2, Oracle and SQLServer. I know all three DB vendors support native XML querying (using SQL and XQuery like state...

Hibernate failing by prepending fully qualified class name to property name on ManyToMany association

I'm trying to map two objects to each other using a ManyToMany association, but for some reason when I use the mappedBy property, hibernate seems to be getting confused about exactly what I am mapping. The only odd thing about my mapping here is that the association is not done on a primary key field in one of the entries (the field is u...