hibernate

Hibernate out of Memory Heap error

I've got a Java application that, among other things, goes out to our Active Directory server every hour, and pulls down a list of all the accounts, and dumps them in a database; this work is done via a thread that's spawned new every hour, and the database interfacing is done via Hibernate. The thread's run method (essentially the only ...

hibernate query performance in order to delete an objcet

Hi, im developping a simple webservice : void deleteCar(int idCar) Currently, what im doing in my code is : 1-to load the cardObjet by id :session.get(Car.class,idCar) 2-to remove it : session.delete(carLoaded) So for an operation i have at least 2 sql query (n+1 problem ?) I dont even speak about any not lazy relationship in the ...

JPA (and/or Hibernate) - How to set timeout threshold for connection and/or query?

I'm trying to figure out how to configure my project such that JPA will timeout and throw an exception after a configured amount of time. There are two situations where I would like this to happen: When JPA is unable to even connect to the database When a JPA query takes longer than the timeout threshold to return a result set I'm no...

Creating a many-to-many relation between an entity and an another many-to-many relation with (N)Hibernate

I'm trying to create a many-to-many association between an entity and another many-to-many association. How can that be done? I followed the Customer/Order/Product example to attach custom properties to a many-to-many association between two of my entities (Categories and Tags). That worked like a charm. The problem is that now I need ...

Difference using @Id and @EmbeddedId for a compound key

I've created an entity that uses @Id to point to an @Embeddable compound key. Everything I believe works fine as is. However, after switching @Id to @EmbeddedId everything continues to work fine as far as I can tell. Before: @Entity public final class MyEntity { private CompoundKey id; @Id public CompoundKey getId() { ...

ORM usage with potentially billions of records

I was thinking of this the other day, apps like Twitter deal with millions of users. I was thinking how the functionality of 'following' would work, where the maximum amount of users in the database can follow the maximum amount of users in the database less one, (himself). If this was a ManyToMany bidirectional mapping, it would cre...

Problems using uppercase names for MySQL columns with Hibernate mapping classes

I want fix problems with uppercase names on a MySQL column of with Hibernate mapping classes. Is there a rule for use these kind of tables with Hibernate? ...

join on foreign key with hibernate

Hi, i am a hibernate-beginner and have a problem when trying to join 2 tables with hibernate. What i am trying to do is get the list of products a certain store has depending on the store id, but what i am getting is the list of all available products in the database listed under every store. Here's the code for Product.java : @Entity ...

How to monitor Apache Camel status?

Hi. I have already working Camel configuration that is watching a database table (through spring and hibernate), and when something shows up in DB, Camel consumes it and sends message to JMS broker. This works flawlessly. And is built in DSL in MyOwnMessageRouteBuilder.configure() Now I'd like to add monitoring that do something if no...

Wicket+Spring+JPA+Hibernate: No Persistence Unit Found

Hi! I'm developing a web application using Wicket+Spring+JPA+Hibernate. This is my first project with this setup and I think I've probably made some mistakes. I get the following error: No persistence unit called "ApplicationEntityManager" found. My persistence.xml file looks like this: <?xml version="1.0" encoding="UTF-8"?> <persiste...

jpa/hibernate drag-n-drop/orm/graphical relations

Hey all, I'm reviewing the IntelliJ ability related to JPA ER Diagrams (http://www.jetbrains.com/idea/features/jpa_hibernate.html), and is something I've been looking for a while. Does anyone know of other tools that have similar abilities, whether as standalone, eclipse plugin, or other alternatives with the intent that the Graphical T...

Pass a parameter to select case with group by in HQL

I have the following HQL(The Hibernate Query Language) query (which is executed on oracle db connection) to retrieve an aggregated sum, based on month select sum(doc._masskg), case when (month(doc._date) = month(:m)) then 'NOW' else 'BEFORE' from Document doc where month(doc._date) <= month(:m) group by case when (mont...

Hibernate Bi-Directional List Association

I'm sure there must be thousands of examples demonstrating this association but I can't seem to find one anywhere. I have a one-many relationship from Parent-Child and a many-one relationship from Child-Parent: class Parent { private Long id; private String name; private List<Child> children; } class Child { private Lo...

HIbernate InvalidDataAccessApiUsageException - read-only mode

Summary: the Exception is telling me that the transaction is read-only; a debug println seems to indicate that I'm not in read-only mode. Classes edited for internet publishing - sorry if I mistyped something but this is the jist of the code giving me problems. saveOrUpdate works when called on other object types but not on this one. ...

Get metadata about components in NHibernate

So, you can use NHibernate.ISessionFactory.GetClassMetadata(System.Type) to get information about a mapped entity class in NHibernate. However when the type is mapped as a component, GetClassMetadata blows up with an exception stating that the class is not an entity. Is there a way to retrieve metadata information about a mapped compon...

COMMIT WRITE BATCH NOWAIT in Hibernate

Is it possible to execute COMMIT WRITE BATCH NOWAIT in Hibernate? ...

Hibernate two tables and one object

Hello, I have this situtation: Table1: tab_id field11 field12 Table2 id tab_id field21 field22 I have to create one object on this two tables for example: object: @Id tabId @Colummn(name="field11") field11 @Colummn(name="field12") field12 @Colummn(name="field21") field21 When i update field21 table2 should update this f...

What is the best way to set a MySQL user variable in a Java, Spring MVC, Hibernate with Annotations web application?

I need to be able to set a MySQL user variable that is used in a trigger in a Spring MVC Hibernate web ap. This user variable is used in MySQL triggers on the tables that are being manipulated by Hibernate. I need this user variable to be correctly set during all of Hibernate's write accesses to the database. Unfortunately HQL does no...

Change Table Name of an Entity on runtime?

There is this is this table that is being generated on a monthly basis. Basically the table structure of all monthly tables is the same. Since it would be a lot of work to map the same entity just with a different table name, Is it possible to change the table name of an entity as follows on runtime since they have the same table struc...

Problem using hibernate with Netbeans

Hi, I using hibernate with netbeans. It's my first time. I'm following this tutorial: http://netbeans.org/kb/docs/web/hibernate-webapp.html#01 All is well, except when I come to the part "Creating the Hibernate Mapping Files and POJOs ". The problem is no classes are being generated. My hibernate.reveng.xml also seems to be short sinc...