I have an error being thrown on deleting an entity. I have users in only one group at a time, so it's a ManyToOne relationship on the User class. In the page class I have a property group:
@Property @Persist private Group group;
that is populated on page activation:
public void onActivate(Group g) {
group = g;
}
When the dele...
Sorry for the noob question, but I'm having problems with JPA+Hibernate so I thought that something is not clear in my mind.
I have some entities, say A, B, C, D and I have coded AMethods, BMethods, CMethods, DMethods. Each of the *Methods classes contain EntityManager initialization via EntityManagerFactory and some methods that basica...
I am a newbie trying to figure out the pros and cons of using Hibernate with Tomcat and with JBoss.
I am developing a web application with Flex at the front-end, BlazeDS as the messaging service and Java at the back-end. We have decided on using Hibernate as the persistence mechanism but would like to know the trade-offs of using it wit...
Hi all
If I have an entity with a parent / child relationship (and Cascade=CascadeType.ALL), and call:
getSession().save(parent)
the primary key of the parent is returned.
Is there a way to access the primary key of the created child?
Regards
Marty
...
I have a Message object associated with a User object (user_from and user_to). I persist the Message instances into a database using Hibernate (with JPA annotations) and the user_id is persisted.
The User object is also stored to the database, but when fetching messages I would like the User to be fetched from a Map in memory instead of...
Hi,
I am working query with little idea of what software I am dealing with and minimum knowledge HQL.
What I am looking is,
SELECT Entity1 FROM Entity AS Entity1
WHERE (EXISTS ELEMENTS(Entity1.config.dateTimeInfo.ntpConfig.server) )
But I want to set a condition saying
WHERE count(ELEMENTS(Entity1.config.dateTimeInfo.ntpConfig.se...
I am having a bitch of a time getting this simple application working. I've got a configuration file in my default class path, using annotations with the correct class entries in the config file, and a default Session factory class that generated by the hibernate eclipse plug in tool. If I only rely on the default classpath config file, ...
If we disable the 'redo logs' of a tablespace in Oracle, will they impact Hibernate's transactions?
These are the options present in the Oracle EM on a tablespace level:
Enable logging
Yes
Generate redo logs for creation of tables, indexes and partitions, and for subsequent inserts. Recoverable
No
Redo log entries are smaller, the a...
Is there a Hibernate configuration (hopefully an annotation on a classes mapped @Column field) that would let me sort a collection of entities associated with the loaded entity by a given column of that entity when a session.load(Entity.class, Id) is called?
For example if I had an EntityA that contained a OneToMany association to an En...
Hi!
I have 2 entities: Parent and Child in a one-to-many relationship. The Parent is versioned, i.e. has a @Version field. My goal is to synchronize changes to both Parent and Child entities on the Parent's version.
E.g. one thread updates the Parent and another one updates one of it's Childs, this should cause an OptimisticLockExcepti...
I encountered some curious behavior today and was wondering if it is expected or standard. We are using Hibernate against MySQL5. During the course of coding I forgot to close a transaction, I presume others can relate.
When I finally closed the transaction, ran the code and checked the table, I noticed the following. All the times I...
I have to test some things on a project which has been developed by others, but is new to me.
They are using Hibernate as a JPA implementation.
I got a virtual machine in which everything is set up, but when I want to start any Testclient (small console programs, no Unittesting). I always get the same error.
Exception in thread "main"...
Are there any advantages of using named queries vs what we have? Looking at performance, usability, maintainability etc etc....
In our application we have defined our queries as such:
private static final String SELECT_CODE_FOR_STORE = "select DISTINCT code from Code code "
+ "join code.codeDescriptions codeDesc "
+ "j...
Basically, I want a way to access sequence values in a database-neutral way.
The use case is that I have a field on an entity that I want to set based on an incrementing value (other than the id).
For instance, say I have a Shipment entity. At some point after the shipment gets created, it gets shipped. Once it gets shipped, a manife...
I'm trying to add a foreign key to an existing table, and was having issues. I figured that I had an error in my syntax, so I updated my hibernate.cfg.xml file to auto-update.
As it turns out, hibernate had the same error. Here's my SQL to add the foreign key:
alter table pbi add index FKEA3F7BDE9BAB051 (FK_idP), add constraint FKEA3...
At the company that I work with, we often have to integrate with client’s infrastructure.
Recently, after hearing that we use Hibernate, one client manifested following concern: Since user under which Hibernate connects to database has a direct access to tables and Hibernate generates SQL dynamically, then such user can do pretty mach an...
I'm wondering if it's possible for Hibernate second level cache (we're using EHCache) to allow an application to cache an Entity that has been comitted to the DB if it knows that no other applications are modifying the DB.
My thought is that if I update record A, then I know the value of record A and should be able to cache that, JVM cl...
I have a database containing approx. 200 tables.
I use jboss-ide to automatically generate hibernate classes from the database using the File->New->Other->Hibernate->Hibernate Mapping file wizard of jboss-ide 1.6.
the problem i'm facing is that the .hbm.xml file generated does not contain all the propertiese it's supposed to. what's als...
I need to make an outer join query that retrieves all of the definitions and any properties they have associated with them that are associated with a certain company.
I have two Hibernate models objects:
class PropertyDefinition {
@Id
private Long id;
@Column
private String name;
@OneToMany(mappedBy = "propert...
Hi,
Suppose a mapping like this one
@Entity
public class User {
private Integer id
private List<Info> infoList;
@Id
public getId() {
return this.id;
}
@OneToMany(cascade=CascadeType.ALL)
@JoinColumn(name="USER_ID", insertable=false, updateable=false, nullable=false)
public getInfoList() {...