Hi all,
I have taken a look at JPA 2.0 Criteria API, but I found it to be too cumbersome unlike Hibernate Criteria. Is there any good reason to use JPA 2.0 Criteria API rather than using JPA-QL? Thanks for your advise.
...
I'm getting these warnings in my application, and it takes a long time get the response from database calls like 10-15 minutes. But is works fairly with slow response time, the problem is this same application works in my friends machine with fast database calls and no hangs under same configurations, even it worked in my machine before ...
I am building a project with Stripes, Spring, JPA & Hibernate amd have an object with a many to one child collection. I have set the loading as Lazy
eg.
@OneToMany(cascade = CascadeType.MERGE, mappedBy = "paperOffering", fetch = FetchType.LAZY)
private List<PaperOfferingAssessment> paperOfferingAssessments;
Now I am getting the Lazy...
I try to execute several queries in one DAO-method. Test is FAILED (the data are not updated). Logs without exceptions.
public List<Domain> getNewDomains(final int maxAllowedItems, final Date timestamp) {
return getJpaTemplate().execute(new JpaCallback<List<Domain>>() {
@SuppressWarnings("unchecked")
public List<Do...
Hello,
I am trying to learn JPA with Hibernate and binding it to a GUI built in Netbeans with Beans Binding. It is a application listing dogs. Each dog can have one to many puppies. You can add and delete dogs, and for each dog you can add and delete puppies.
The dogs are displayed in a JList, when the user selects a dog its properties...
Hi!
How i can map structure like this
into
class A{
Map<SomeEnum, B> foo;
}
where key in foo is representation of role in a_ has _b ?
Thanks!
...
Is there any hibernate certification available to test Hibernate fundamentals?
...
hi,
I'm looking to create a HQL query that does the following:
public Collection getCollection(Collection sons)
{
//return collection of fathers who's have all of the sons from the param
}
i'm a bit mixed up as to when to use query is HQL syntax (join etc..) and when to use "Criterias"
Thanks in advance
...
I have the following class:
class User {
String username;
@CollectionOfElements
private Set<String> roles = new HashSet<String>();
[many more things here]
}
And I want to write a HQL query that retrieves the username and the roles for all the users.
Query query = session.createQuery("select distinct u.username, u.roles from User u");...
Is there any gem that enables you to use something like the Criteria API from the Java persistence framework Hibernate?
I think Hibernate Criteria API is one of the bests APIs ever for queries and I really miss it when developing in Ruby on Rails. I really don't like the way Raills work with ActiveRecord for queries.
...
Hi all,
I'm trying to map my Hashmap in Hibernate.
All examples I can find are simply like this:
class FooBar{
Map<String,String> myStrings;
}
Which would simply map to
<map role="ages">
<key column="id"/>
<index column="name" type="string"/>
<element column="age" type="string"/>
</map>
However, I use a more object-oriented ...
I've been asked to output a CSV file from a view in MySQL. The app I currently am writing uses Spring and Hibernate to create the database, but the view is just handed to me.
Hibernate doesn't know anything about this view, but I'd want to do something like this:
public List<Object> getCsvView() {
return (List<Object>) getHibernate...
I am storing a relatively complex immutable object in a database. There are many many-to-one associations - the object has properties that have properties and so on.
I would like to have each object stored only once, based on a business key that is in this case every single property of the object.
The workflow is like this:
user cre...
I have a Hibernate entity named Menu which has a collection of Groups, each group in turn has a collection of MenuItems. So as an example, a menu can be for a restaurant, groups can be Lunch and Dinner and the menuItems within these can be Pasta, Burger, Salad.
The problem I'm having is that once i have created the menu and saved it ...
I'm mapping a set of attributes to my entity using @CollectionOfElements. The goal here is to be able to provide a meta data list that can be used in a query to pull specific entries.
I've figured out the mapping and how to run the queries I want. The problem is that hibernate won't persist null values!
@CollectionOfElements()
...
I have the following mapping in an Ad entity:
class Ad ... {
@Id
@Column(name = "id", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_ad_generator")
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id", nullable = false)
...
Hello all,
Beginner here to hibernate, spring. Followed tutorial here to setup hibernae + spring + struts2 project:
http://splinter.com.au/blog/?p=224
I wanted to prepare queries. So I tried following:
Services.java
public class Services {
protected SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory value) ...
My PostgreSQL tables have id's of type bigserial, meaning they are generated at the time rows are inserted (and thus, the id column's value is not supplied in the INSERT statement). I'm having difficulty finding the proper value for the <generator class="..."> attribute in my XML mapping file.
The code below is the closest I've found t...
Here is an example of my mapping file:
<!-- ============================ -->
<!-- Table TABLE1 -->
<!-- ============================ -->
<class table="TABLE1"
name="com.myCompany.Entity1" lazy="false" schema="SCHEMA1">
<!-- Attributs -->
<id column="ID" name="id" type="string" />
<property column="ACTION_TYPE" name="acti...
I am using Hibernate and MySql.
I have a 2 tables:
User: id, name, type
City: id, name, type
type: id, name
Where user.type has foreign key to user_type.id. and as well city.
I would like before deleting a row in user_type table, to check if any row from any table is related to it.
my columns are mapped for example:
@ManyToOne(fet...