Hey folks,
I've got a really weird problem with a bi-directional relationship in jpa (hibernate implementation). A User is based in one Region, and a Region can contain many Users.
So...relationship is as follows:
Region object:
@OneToMany(mappedBy = "region", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
public Set<User> getUse...
Given JPA annotated Entities, is it possible to generate (i.e. before runtime) the list of queries that will be performed by Hibernate for CRUD operations (performed against EntityManager) ?
For named queries it is possible using org.hibernate.hql.QueryTranslator
Any pointer into the Hibernate API will be appreciated.
...
I'm still in the process of learning hibernate/hql and I have a question that's half best practices question/half sanity check.
Let's say I have a class A:
@Entity
public class A
{
@Id @GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
@Column(unique=true)
private String name = "";
//getters, setters, ...
We are using Quartz with Spring and our configuration is throwing deadlocks when quartz has more than 1 thread configured. I'm starting to believe that it's because we don't have our quartz configured correctly with Spring, but I can't find enough documentation on how to configure the two to play nicely.
We are running on both Windows a...
when i update a table using hibernate
getHibernateTemplate().bulkUpdate("UPDATE Channel SET number = 40 AND active = 0");
i get error: ERROR [PARSER]: unexpected token: AND
evething run well if i remove AND active = 0
i dont know how to correct this query.
help me pls, thanks :)
...
I want to connect to MS SQl server 2005 using hibernate in java. i am unable to find the jars and the hibernate.cfg.xml file for the same. can someone help me with the same
...
I want to create a web app that will use wicket, hibernate and spring frameworks. My IDE of choice is Eclipse, I am using maven for the .war generation and I am running Mac OS. What steps should I follow to correctly install and configure all the tools so as to have a project running that relies on these 3 frameworks. I was able to succe...
Ruby on Rails has polymorphic relations which are really useful for implementing functionality such as commenting, tagging and rating to name a few. We can have a comment, tag or rating class which has a many to one polymorphic relationship with a commentable, taggable and rateable object. Also, a given domain object can choose to imple...
I am looking for documentation for Hibernate HBM tag (e.g. allowed attributes for each tag)
...
Hi, I got an existing table in Oracle database how can I generate my Hibernate Java class etc from this table?
Using Eclipse 3.2, Java 5
...
I'm trying to figure out this mapping, and somehow it's just eluding me. It's irritating, because it seems like it should be a common case.
I have a basic Parent and Child class with a join table between them. The Child class is dependent on the Parent: if an Child is removed from the Parent, the Child ought to be deleted as well. The H...
I am new to hibernate queries, and trying to get a grasp on how everything works. I am using Hibernate 3 with Netbeans 6.5.
I have a basic project set up and have been playing around with how to do everything. I started with essentially a search query. Where the user can enter values into one or more fields.
The table would be Person ...
I have the following query:
SELECT DISTINCT w.name, count(*) FROM widgets AS w
JOIN w.entity AS e
JOIN e.article AS a
JOIN a.document AS d
WHERE d.id IN (<document ids>)
GROUP BY w.name
The problem is that count(*) returns the number of widget-entity associations. Instead, what I'm looking for is the number of unique widget names, per...
I have the following class
public class ElementBean {
private String link;
private Set<ElementBean> connections;
}
I need to create a map table where elements are mapped to each other in a many-to-many symmetrical relationship.
@ManyToMany(targetEntity=ElementBean.class)
@JoinTable(
name="element_elements",
joinColumns=@Jo...
Hi guys,
I'd like to understand how it is possible:
Until I was working with one table everything worked fine,
when I have mapped another table it fails as shown below:
Glassfish start
INFO: configuring from resource: /hibernate.cfg.xml
INFO: Configuration resource: /hibernate.cfg.xml
INFO: Reading mappings from resource : hibernate_ce...
I have an ExamResult class which has a link back to it's parent Exam.
I wish to filter by a boolean property on exam result.
List<ExamResult> examResults = session
.createCriteria(ExamResult.class)
.createCriteria("exam") // 3.
.add( Restrictions.eq("primaryExam", Boolean.TRUE...
I want to use a custom sequence generator in my application, but the entity is located in a domain model jar that is shared with other applications. Apparently entity annotations can be overridden in orm.xml but I can't figure out the proper XML incantation to get this to work.
I can modify the annotation in the entity like this this:
...
I have been working on it for quite a while, but still can't figure out what's wrong with my code.
Each Service has multiple profiles, but each profile only has one Service.
Service
{
Long service_id; // primary key
... getter/setter
}
Profile
{
Long profile_id; // primary key
Long service_id; // foreign key
... getter and setter
}
i...
I think this is pretty much the simplest case for mapping a Map (that is, an associative array) of entities.
@Entity
@AccessType("field")
class Member {
@Id
protected long id;
@OneToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
@MapKey(name = "name")
private Map<String, Preferences> preferences
...
hi,
i am developing a plug in which deals with hibernate project.I get some classes which contain Session and Session factory .Then i want to instantiate an object of these classes using reflections which i am not able to do it even after including the hibernate jars in the classpath of my plug in.What is the problem?Help
Here is the ...