jpa

JPA/Hibernate maximum number of joins?

Is there a limit to the number of joins permitted in a JPA/Hibernate query? Since Hibernate doesn't automatically join, I have to explicitly specify the joins in my JPA/Hibernate query. For example, person has an address, an address has a state. The following query retrieves person(s) with address and state fully loaded: select p, a, s...

Hibernate equivalent to EclipseLink's batch query hint?

One thing I like about EclipseLink has this great thing called the batch query hint, which I'm yet to find a Hibernate equivalent of. Basically doing a whole bunch of joins gets messy real quick and you end up querying way more data than you necessarily want (remember that if you join person to 6 addresses the person information is retu...

Hibernate daily builds

Are there daily builds of Hibernate that I can download? I need the latest version for a bug fix that isn't in the released versions. I'm currently trying to build the latest version but am running in to all sorts of test case failures. If would be faster if there's a daily build that I just download and use. ...

Spring and hibernate.cfg.xml

How do I get Spring to load Hibernate's properties from hibernate.cfg.xml? We're using Spring and JPA (with Hibernate as the implementation). Spring's applicationContext.xml specifies the JPA dialect and Hibernate properties: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <propert...

Hibernate second level cache with Spring

I'm using Spring + JPA + Hibernate. I'm trying to enable Hibernate's second level cache. In my Spring's applicationContext.xml I have: <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop> <prop key="hibernate.cache.provider_configuration_file_resource_path">/ehcache.xml</prop> When I run ...

JPA: 'SELECT DISTINCT' with BLOB columns

I'm trying to run this JPQL query: SELECT DISTINCT i FROM Table i JOIN i.other o which promptly fails with: "Internal Exception: java.sql.SQLException: Columns of type 'BLOB' may not be used in CREATE INDEX, ORDER BY, GROUP BY, UNION, INTERSECT, EXCEPT or DISTINCT statements because comparisons are not supported for that type." This...

Hibernate Performance Tweaks

In your experience what are some good Hibernate performance tweaks? I mean this in terms of Inserts/Updates and Querying. ...

JPA EntityManager find with case sensitive key

I'm trying to use the JPA EntityManager find() method. My primary key is a string which corresponds to a user's name. I am using JPA / Hibernate / MYSQL. My problem is a search for user 'David' matches user 'david' due, I assume, to the case insensitive string matching in the underlying MYSQL. This causes me a whole heap of problems!...

Hibernate and IDs

Is it possible in hibernate to have an entity where some IDs are assigned and some are generated? For instance: Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database. ...

Hibernate ID Generator

Anyone know of some good tutorials on how to create a custom ID generator for hibernate? ...

How easy is it to set up JBoss Seam to run on GlassFish with JPA instead of Hibernate?

Question pretty much says it all - I'm interested to find out about how to set up JBoss Seam on a GlassFish (v3 prelude) application server rather than JBoss. Also, I prefer JPA over Hibernate for persistance but it looks as though Seam has dependencies on Hibernate (or at least parts of it), has anyone got any experience with a stack li...

Mapping a bidirectional list with Hibernate

I don't understand the behavior of Hibernate when mapping a bidirectional list. The SQL statements that Hibernate produces seem not optimal to me. Can somebody enlighten me? The scenario is the following: I have a one-to-many parent-child relationship. I map this relationship with a bidirectional list. According to the Hibernate Annota...

JPA/Hibernate store date in UTC time zone

How can I configure JPA/Hibernate to store a date/time in the database as UTC (GMT) time zone? Consider this annotated JPA entity: public class Event { @Id public int id; @Temporal(TemporalType.TIMESTAMP) public java.util.Date date; } If the date is 2008-Feb-03 9:30am Pacific Standard Time (PST), then I want the UTC t...

Batch deletion / purging of records via Java ORM

Right - I want to delete (e.g.) 1,000,000 records from a database. This takes a long time -> the transaction times out and fails. So - I delete them in batches say 25000 records per transaction. Using the limit clause on MySQL or ROWNUM on Oracle. Great this works. I want to do this in a database indepedent way. And from an existing Jav...

Hibernate vs JPA vs JDO - pros and cons of each?

I'm familiar with ORM as a concept, and I've even used nHibernate several years ago for a .NET project; however, I haven't kept up with the topic of ORM in Java and haven't had a chance to use any of these tools. But, now I may have the chance to begin to use some ORM tools for one of our applications, in an attempt to move away from a ...

How to store an object instance as a field of an EJB3 entity?

I have an entity Promotion, which has 3 simple fields (id, name, description) and all 3 will be mapped to DB. So far so good. Problem is with the 4th field, ruleModel, which is an instance of RuleModel and when constructed at runtime, it will contain object instances of a dozen other classes. I don't want to map RuleModel to a DB table, ...

JPA and Hibernate Fetch ignoring Associations?

I have JPA entity (Object A) with a One-Many owning relationship (Object B) in an ArrayList. I want to be able to query (either Hibernate or JPA) for Object A without having any of the instances of association Object B returned (no proxies or otherwise) in the One-Many ArrayList. Ideally the returned ArrayList would be null or empty. ...

Has anybody used JPA with Red5?

Hi! I'm developing a red5 application. I have to retrieve some data from the database and I want to use JPA to do this, preferably the toplink implementation? I know that red5 deploys application with Spring and I also know that I have to configure the red5-web.xml but I don't have any idea how to do this. Does anybody here know how t...

Can I inject properties into a JPA Entity Listener

I could prototype this and see what happens, but I am being lazy. I want to be able to inject an EJB3 into my JPA Entity Listener so that it can access functionality of the EJB during the PrePersist operation. Is that possible? If not... then under JBoss, will the Listener be created once, or once per method invocation? I guess I am tryi...

What is the difference between TopLink Essentials & EclipseLink

What is the difference between TopLink Essentials & EclipseLink, both originates from Oracle ? ...