I have an application in Grails.
I use Hibernate to access the database (per standard grails rules)
I use MySql and the site works and is stable (for 6 months).
I am doing load testing, and recently discovered that the database rejects connections when under load.
Using MySQL Server 5, I can see threads connected hovering around 20. Th...
Hi all,
I have made use of the following JPA implementations:
Hibernate,
Toplink,
OpenJPA
Each of them has their own strengths and weaknesses. I found Hibernate the most advanced of the three except that it mixed some of its own enhancements with JPA which made it difficult to switch out to other providers. Most importantly, its que...
I am working on a project for a customer who wants to use lazy initialization.
They always get "lazy initialization exception" when mapping classes with the default lazy loading mode.
@JoinTable(name = "join_profilo_funzionalita", joinColumns = {@JoinColumn(name = "profilo_id", referencedColumnName = "profilo_id")}, inverseJoinColumn...
If I have a util class with static methods that will call hibernate functions to accomplish basic data access. I am wondering if making the method synchronized is the right approach to ensure thread-safety.
I want this to prevent access of info to the same DB instance. However, I'm now sure if the following code are preventing getObject...
I'm using nHibernate to map an object very similar to .NET's System.Web.SiteMapNode. In order to keep my object similar to this .NET object I would like to have it contain a ParentNode, PreviousSibling, NextSibling, and ChildNodes complex properties.
The table looks somewhat like this and is open to be changed:
ID (int)
Title (string...
I'm working on repairing the test suite for a project of ours, which is being tested through Hibernate/DBUnit. There are several test cases which all throw a similar exception from Hibernate, which looks something like this:
java.sql.SQLException: Not in aggregate function or group by clause: org.hsqldb.Expression@109062e in statement ...
Hello,
I am trying to learn how Hibernate works, and I am running into an almost unacceptable learning curve. I can't see how to get Hibernate to respect the auto_increment policy for my objects. Instead, it is overwriting entries in the database with existing IDs, beginning with 1.
I have a simple Foo object, backed by a MySQL table d...
Triggers seems like a simple solution for Audit logging. Why should I use Interceptors?
Database portability is one con of trigger...
what are others?
...
Hi I'm having a problem updating child objects in the following scenario.
The mappings are as follows:
Parent: Calendar
<bag name="defaultCategories" inverse="true" lazy="false"
cascade="all-delete-orphan">
<key column="parentID" />
<one-to-many class="DefaultCategory"/>
</bag>
Child: DefaultCatergory
<class name="Def...
Using HQL, I would like to search for the starting index of sequenced objects.
For example, if I have the following persisted classes:
<class name="Word">
<id name="id" type="int">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<many-to-one name="sentence" class="Sentence"/>
<property name="...
if I write in HQL
A between 5 and 10
is that equivalent to
A >= 5 and A <= 10
or
A > 5 and A < 10
or some other of the 4 combinations?
...
Where can I find a list of all HQL keywords?
...
I'm using JPA with a postgres DBMS and I'm trying to create a new entity that maps to the table "User".
This is a very common problem as User is a reserved word in Postgres. My question is, how can i "escape" the reserved keyword or set JPA to escape it?
I tried @Table(name = "\"user\"") with no luck:
2009-02-25 15:43:14,218 ERROR...
I want a single HQL query that returns all groups containing a given user that where created before a given date. Somehow I can't get it right.
public class Group
{
@ManyToMany
Set<User> users;
Date created;
}
public class User
{
...
}
...
For example, not to build queries by string manipulation, and the like.
...
Let's say I have a mapped User object with a user_id as a primary key, and a mail column with a unique constraint.
I want my program to save a User object to the users table only if it doesn't exist.
I can do the following thing in my insert function:
begin transaction
query for a user with the given mail
if it doesn't exist, create a...
I have the following entity structure: Business --> Campaign --> Promotion, where ONE Business can have MANY Campaigns and ONE Campaign can have MANY Promotions. Both one-to-many relations are declared as LAZY. One place in my code, I need to eagerly fetch both collections from a Business, so I do:
Query query = entityManager.create...
I have an EJB 3 Entity bean that has a String property annotated with: @Column(unique=true). This value is set from a JSF page.
Everything works fine as long as the user does not add whitespace add the end of the input field. In that case "someName" and "someName____" are treated not unique and are stored in the database. Is there a con...
Is it possible to use hibernate as Glassfish's persistence provider and if so HOW?
...
This question is somewhat related to http://stackoverflow.com/questions/305880/hibernate-annotation-placement-question.
But I want to know which is better? Access via properties or access via fields?
What are the advantages and disadvantages of each?
...