public class Room {
static belongsTo = [hotel:Hotel]
Source source
long sourceid
RoomType type
float price
float oldPrice
Currency currency
boolean isShown = false
boolean approved = false
static hasMany = [roomTexts:RoomText]
def beforeDelete () {
Photos.withNewSession {
Photos.findAllByRoom(this).each {...
Hi!
I'm catching javax.persistence.OptimisticLockException which works great, but I'm getting the stacktrace of StaleObjectStateException in my server log. I've checked and the getCause() on OptimisticLockException returns StaleObjectStateException, but why is it printed out to server.log? It's really annoying, I'm writing a test, where...
Hi all, I'm having trouble with hibernate not able to open a connection. I have a DAO:
public class MyDao extends HibernateDaoSupport
{
DataSource dataSource;
public void setDataSource(DataSource dataSource)
{
this.dataSource = dataSource;
}
public MyPOJO findByQuery(int hour)
{
Query query = th...
I have a program which reads a text file line by line, and creates a Hibernate entity object from each line, and saves them. I have several such text files to process, each of which has about 300,000 lines. I'm finding that my current implementation is excruciatingly slow, and I'm wondering if there's anything I can do to improve thing...
I'm working with an existing database (that cannot be changed) that uses composite keys. I trying to create a native SQL join for a collection however Hibernate is trying to retrieve a value from the result set that isn't there ("PID1_0_"). I'm almost certain I'm missing something in my "load-collection" element.
Can you please help?
...
Hi,
I am trying to use NHibernate to save an object that was completely manually created. My mappings are in place and I currently have no data in the database. Everytime I call Save() or SaveOrUpdate(), NHibernate does a select statement for what I am trying to save. Then it gives me the exception: "a different object with the same ...
Currently I'm using Hibernate to persist the entities within my app and I serve the entities back to my users in the form of XML. However this means that each time a resource is request I'm currently generating XML via Java which is ineffecent for a lot of reasons. I was wondering if I want to perhaps create a cache of Document objects w...
Hello,
I'm having difficulties with translating following SQL syntax into Criteria API:
SELECT AVG(dbo.Member.Points) FROM dbo.Member WHERE dbo.Member.PaidMemberRegDate IS NOT NULL;
I have a Member class with a Points property. I just want to get the average Points of all Members that have the property PaidMemberRegDate set to null.
...
Hibernate mapping question where the behavior is ambiguous and/or dangerous. I have a one-to-many relationship that has a cascade-delete-orphan condition AND a where condition to limit the items in the collection. Mapping here -
<hibernate-mapping>
<class name="User" table="user" >
<!-- properties and id ... -->
<set table="em...
Hi,
How do I get NHibernate to save or update using column other than the <id>? I've implemented an identity key column in a table but this is not what makes a row unique. I know that "composite-id" exists but I heard that that should only be used on legacy databases, where there is not much freedom to change it. Is there any other w...
Does Ehcache 2.1 now support the transactional cache concurrency strategy in Hibernate 3.3.2GA? That is, does Hibernate, when configured to use Ehcache 2.1 as its cache provider, allow the <cache usage="transactional"/> element in a mapping file or the Hibernate entity class annotation @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)?
...
Hi,i am coming back because i still have problem using JodaTime. After the previous comments, i modified my pom and the @Type annotation is fixed. Here is my new pom :
<properties>
<org.springframework.version>3.0.3.RELEASE</org.springframework.version>
<hibernate.version>3.6.0.Beta1</hibernate.version>
</properties>
<dependenci...
I've created two JPA entities (Client, InstrumentTraded) using Hibernate as a provider that have a ManyToMany relationship. After letting Hibernate generate the tables for MySQL it appears that the ManyToMany relationship table does not contain primary keys for the two foreign keys. This allows duplicate records in the many-to-many tab...
We have a JPA -> Hibernate -> Oracle setup, where we are only able to crank up to 22 transactions per seconds (two reads and one write per transaction). The CPU and disk and network are not bottlenecking.
Is there something I am missing? I wonder if there could be some sort of oracle imposed limit that the DBA's have applied?
Network...
I'am running my JunitTest and it gives the following error.. not failure.
Error creating bean with name 'reportDAO' defined in class path resource [LT.xml]:
Cannot resolve reference to bean 'hibernateTemplate' while setting bean property 'hibernateTemplate';
nested exception is org.springframework.beans.factory.BeanCreationException...
Hello,
I have some problem with @OneToMany and @ManyToOne annotations.
I have two class Suite and SuiteVersion. A SuiteVersion is dependent of a suite. So i have implemented this in my code:
Class Suite :
@OneToMany(mappedBy = "suite")
@Cascade(CascadeType.DELETE_ORPHAN)
private List<SuiteVersion> listSuiteVersion = new ArrayList<Sui...
I have a question with HQL query and hibernate.
I have a user class and a role class. A user can have many roles. So I have a ManyToMany relatation like this:
In user class:
@ManyToMany(fetch = FetchType.LAZY)
@oinTable(name = "PORTAIL_USERROLE", joinColumns = { @JoinColumn(name = "USERID", nullable = false, updatable = false) }, inve...
Hello everyone,
Our current database (MySQL) already has Indexes for its foreign keys since these use InnoDB, which (afaik) automatically generates IndexTables for foreign keys. Hibernate wasnt used to create these tables. So my question is: Is MySQL using Indexes for their foreign keys automatically, when I use Hibernate to fetch Data ...
Hello,
I would like to know if there is a method to execute some code when Hibernate Initialisation Database finish ?
Thank you for your help,
Best regards,
Update
I will try to be more precise:
When you open a session factory hibernate do some stuff before become avalaible. Is there a way to know when is finish to do some code aft...
Is there a way to select specific column using the JPA 2 Criteria API?
The following is the target SQL Statement:
SELECT column1, column2 FROM MyTableThatHasMultipleColumns
With Hibernate's Criteria API this can be done using Projections, is there an equivalent to the JPA 2 Criteria Specification?
...