Hello,
I'm trying to add an object to a collection in my client view and to save it on server with hibernate/jpa mechanism.
Here is the problem:
Take a Group object which can contains Account objects.
On my client view (gwt), I create a new group (so the id is null) and I add to this group some accounts (where ids exist). BUT these ac...
My problem seems pretty straightforward to me, but I just can't seem to find an answer that works. I have a Hibernate Entity which has a ManyToMany association with another Entity, which is fetched lazily by default. I want to create a Criteria which will return the Entity with the ManyToMany association loaded eagerly.
Here is the Enti...
Is it possible to limit the number of associated entities fetched through a Hibernate Criteria? Consider the following two entities:
@Entity
public class History {
@OneToMany
private List<Entry> entries
...
}
@Entity
public class Entry {
@ManyToOne
private History history;
private DateTime date;
...
}
I need to us...
why does hibernate not force you to mark fields as virtual, but nhibernate does?
Is this a result of the differences between the VM and CLR?
...
With Hibernate, how do I load an entity using generics?
Curretly I am doing:
Entity e = (Entity) session.load(Entity.class, 123);
In NHibernate, with generics, I can do:
session.Get<Entity>(123);
What's the Hibernate equivalent?
...
In our system we have multi-threaded processing engine. During processing each thread calls methods to retrieve data from the database. We determined that performance is greatly improved if methods called from the same thread use the same DB session (sessions are coming from the pool of course).
Is there any standard way in Spring to e...
My question is when to use a specification pattern, and when to use specific SQL query.
I understood that specific pattern need to collect whole collection and post filter using concrete specification. But i dont't understand the advantage in front of specific SQL query.
CarColorSpecification cc = new CarColorSpecification(RED);
CarAge...
with hibernate, how can I set a query to be read uncommitted?
I don't want this to be a global setting, just want to do it on a per query basis.
...
before calling session.gettransaction, do I have to ensure one exists?
if so, how do I check if there is a current uncommitted transaction in the session?
...
I'm working on a utility to update a list of entities in a database as a group. The database contains a list of entities. The result of the update is a new list. The API accepts this new list.
The update may end up modifying some of the entities in the list, creating new ones and deleting some. So at the entity level, I may have to do a...
I need to be able to find all items in a table where the id of each item is not in a relational mapping table. In other words, I have one table where each row has an id. If that id is in a map table, it should not show up in my list.
I was thinking of querying my map table for all id's in it, then turning around and querying my main t...
Q1. i do understand when we need to deal with multiple databases, we need to use global transaction. but from this post http://fogbugz.atomikos.com/default.asp . the person suggested just use spring aop to advise on the different transactionmanager ( more > datasource/sessionfactory). can anyone explain in what kind of situation we ca...
can anyone explain on this 2 properties
Q1. hibernate.cglib.use_reflection_optimizer ? what is the effect of setting to true and false
Q2. hibernate.c3p0.max_statements . i read hibernate doc https://www.hibernate.org/214.html. it only mentioned default value is 0. I am using oracle10g, and i set to 100. but i want to know how to ...
select CONTRACT_ID, sum(PO_SPEND)
from V_CONTRACT_ANALYSIS_202
group by CONTRACT_ID
order by sum(PO_SPEND) desc
...
I have 2 domain classes with a many-to-many relationship in grails: decks and cards.
The setup looks like this:
class Deck {
static hasMany = [cards: Card]
}
class Card {
static hasMany = [decks: Deck]
static belongsTo = Deck
}
After I delete a deck, I want to also delete all cards which no longer belong to a deck. The easiest way t...
I define my data model using Fluent nHibernate POCO classes + mappings. I'm also using nHiberate schema to create database schema.
All is working fine but there is one unpleasent fact.
When I use many-to-one reference referece is named by something similair to GUID instead of any descriptive name.
Here's a piece of SQL:
alter table [Odb...
I can use MySQL views in Hibernate by treating them like tables - ie. the entity is no different than one created for a table. However my application won't deploy when Hibernate is set to validate the model as it can't find the View as it assumes it's a table.
Is it possible to use Hibernate Entities with deploy time validation turned o...
I'm thinking about table layout for a Hibernate-managed class hierarchy, and certainly the table per subclass technique strikes me as the most appropriate in a general sense. However, thinking through the logic I have some concerns about its performance especially as the number of subclasses scale.
To give a very brief (and classic) ex...
The question is in the title. Below I just described some of my thoughts and findings.
When I had very simple domain model (3 tables without any relations) all my entities did NOT implement Serializable.
But when domain model became more complex I got RuntimeException which said that one of my entities didn't implement Serializable.
I...
Hi im a newbe to HQL and have a SQL expression I need converted but am unable to select the SQL statement is:
select SenseDate as Time,SenseValue as Value
from UserData
where NetworkID = '23'
and IODeviceID = '129'
and SenseDate >= DateAdd("d",-1, GETDATE())
and SenseDate<=GETDATE()
and can run this part in HQL without problems:
from...