Hibernate is an object-relational mapping (ORM) library for the Java language enabling developers to utilize POJO-style domain models in their applications in ways extending well beyond Object/Relational Mapping.
Hibernate is the umbrella for a collection of libraries, most notably Hibernate ORM which provides Object/Relational Mapping for java domain objects.
In addition to its own "native" API, Hibernate ORM is also an implementation of the Java Persistence API (jpa) specification.
I've created an Aspect which contains an @Transactional annotation. My advice is being invoked as expected, but the new entity AuditRecord is never saved to the database, it looks like my @Transactional annotation is not…
I have the following entity:
package com.server.models;
@Entity
@Table(name="users")
@NamedQueries({
@NamedQuery(name=User.QUERY_FIND_USER,query="SELECT c FROM user c WHERE c.username = :username")
})
public class User {
public static final…
I am interested in how hibernate.hbm2ddl.auto=validate actually works and I am struggling to find comprehensive documentation.
We've recently discovered production system was affected by…
I am using spring boot and hibernate over jpa with tomcat connection pooling. Can you please help me understanding how spring uses DB connections during transactions. For example consider following scenario:
We have DB connection pool of 2…
In the "good old JDBC days" I wrote a lot of SQL code that did very targeted updates of only the "attributes/members" that were actually changed:
For example, consider an object with the following members:
public String name;
public String…
I have several Java classes with double fields that I am persisting via Hibernate. For example, I have
@Entity
public class Node ...
private double value;
When Hibernate's org.hibernate.dialect.Oracle10gDialect creates the DDL for the Node…
I have the following code:
@Entity
@Table(name = "my_table", schema = "my_schema")
@SequenceGenerator(name = "my_table_id_seq", sequenceName = "my_table_id_seq",
schema = "my_schema")
public class MyClass {
@Id
…
I need to be able to insert/update objects at a consistent rate of at least 8000 objects every 5 seconds in an in-memory HSQL database.
I have done some comparison performance testing between Spring/Hibernate/JPA and pure JDBC. I have found a…
I'm trying to integrate spring and Hibernate with mysql. I created a simple java project and a package with 3 classes, an application context.xml file, and an hbm.xml for mapping. But after executing, I get this error:
Error:
Sep 17, 2014 1:27:49…
I'm quite new to hibernate and have stumbled on this problem, which I can't find solution for.
When persisting parent object (with one-to-many relationship with child), the foreign-key to this parent is not stored in child's table.
My…
The Hibernate documentation gives some information at @BatchSize as :
@BatchSize specifies a "batch size" for fetching instances of this
class by identifier. Not yet loaded instances are loaded batch-size at
a time (default 1).
I am not clear…
In a new project we would like to use Spring Data JPA and define interfaces for all JPA entities, e.g. like this:
public interface Person extends Serializable {
void setId(Long id);
Long getId();
void setLastName(String lastName);
String…
The Hibernate documenation gives some of the Hibernate configuration properties. Among them,
hibernate.max_fetch_depth
Sets a maximum "depth" for the outer join fetch tree for single-ended
associations (one-to-one, many-to-one). A 0 disables…
I try to add the following code to a spring data jpa repository:
@Query("insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)")
void insertLinkToActivity(long commitId, long activityId);
But an app can't start with the…
Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence?
This is my composite class:
@Embeddable
public class IntegrationEJBPk implements Serializable {
//...
…