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 ...
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 ...
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...
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 ...
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() {
...
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...
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?
...
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
...
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...
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...
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...
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...
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...
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. ...
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...
Is it possible to execute COMMIT WRITE BATCH NOWAIT in Hibernate?
...
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...
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...
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...
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...