hibernate

Bypassing the Hibernate cache in a transaction

I have a strange use case of Hibernate where in a call farther up a large stack needs an unmodified copy of an object that is part of a hibernate transaction. however, every time I ask Hibernate for a copy of the object, it's returning the version that's already been modified / is part of the transaction. Is there a way for me to force...

Duplicate a collection of entities and persist in Hibernate/JPA

Hi, I want to duplicate a collection of entities in my database. I retreive the collection with: CategoryHistory chNew = new CategoryHistory(); CategoryHistory chLast = (CategoryHistory)em.createQuery("SELECT ch from CategoryHistory ch WHERE ch.date = MAX(date)").getSingleResult; List<Category> categories = chLast.getCategories(); chN...

hibernate - component mapping vs custom value type

Please tell me what is the difference between component mapping - custom value type and when to use it? Thank you. ...

hibernate creates problem for table with composite primary key while generating hibernate classes with eclipse

Hello friends, I have 2 tables as given below. feedback_answer question_id number(primary key) answer_id number (primary key) answer_en varchar2(255) answer_it varchar2(255) user_feedback verification_id number(primary key) question_id number(foreign key - feedback_answer) answer_id number(foreign key - feedback_answer) ...

EntityManager.merge inserts duplicate entities

Hi all, I've got a pretty special setup: I create all the classes in Java, connect them in my application (several ManyToOne-relationships). Then, I'd like to iterate over my objects and save them into the database. Sometimes, an object is already in the database, then it should not be persisted again. I implemented the hashCode() and...

JBoss Seam using LDAP Indetity Store and JPA Identity Store together

Hello all, I've been recently working on a JBoss Seam project (v2.1.1) where I want to autheticate against LDAP/AD and store premissions in a custom DB schema. The documentation states that this is possible and I saw a text-book example that doesn't work for me since the DB schema is managed by Hibernate. Has anyone out there done some...

hibernate - delete hql in eclipse hibernate tool

I tried to execute a delete query as following in eclipse's HQL tool delete from Address address where address.id = 6 but i got the org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations Please tell me that i've done wrong. Thank you. ...

How to query a property of type List<String>in JPA

Lets say we have this JPA-annotated class, with a property of type List. This code is currently working fine. @Entity public class Family { ... @CollectionOfElements(targetElement=java.lang.String.class) @JoinTable(name = "elements_family", joinColumns = @JoinColumn(name = "idFamily") ) @Column(name = "elemen...

Hibernate/JPA/HSQLDB Enum issues...

I am using Hibernate annotations and entity manager (JPA) with HSQLDB. So I have an entity with an enum field: @Enumerated(EnumType.STRING) @Column(name = "access_level") public AccessLevel getAccessLevel() { return accessLevel; } Where AccessLevel is an enum. I can persist this, detach, and then query and everything is as it sho...

Are Hibernate and RDLC alternatives to each other?

I know Hibernate is an ORM, I'm not familiar with RDLC, is it an ORM as well? If they are both ORMs wouldn't it make sense for an application team to choose to use one rather than the other during development (as opposed to using both)? ...

Transaction error while updating data

Following error occurs while updating a particular data in my web application.I am using HibernateTransactionManager to manage all transactions in the application. Error:- Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource...

Does an EJB-QL UPDATE statement defeat CMP...

Does running an EJBQL UPDATE statement defeat the performance benefits of container managed persistance when compared to modifing the accessors on a managed entity? I'm interested in this specifically for a database load / performance perspective. For example, if I have an entity called MyEntity and I want to update myField1 and myFiel...

Hibernate - Entity Manager Factory

Hi all, I have been recently running into an issue in which my web application will not start properly and the stack trace doesn't indicate exactly what happened. I have been able to isolate it to an event listener that I wrote. Whenever I attempt to activate it, I get a very generic exception: org.jboss.seam.InstantiationException: ...

Hibernate Vs iBATIS

For our new product re-engineering, we are in the process of selecting the best framework from Java. As the consideration is to go for database agnostic approach for model, we are working on options between Struts + Spring with iBATIS or Hibernate. Please advice which is best as both offer persistence. ...

Two mappings for one database table

Hi, first of all, i apologize for such a question. I'm trying to find a solution for an architectural error (i'm not the architect :P ) Is there the possibility to have two mappings for the same table in Hibernate3? The first one would have some lazy attributes set to true. The second mapping would ha some lazy attributes set to false;...

NHibernate - Exclude a property from a projection list (select clause)?

I have classes that look like this public class Agreement { public virtual string ArrgKey { get; set; } public virtual string SubjectCode { get; set; } // mapped as a HasMany to AgreementStateCountyRelation public virtual IList<AgreementStateCountyRelation> StateCounties { get; set; } } public class AgreementStateCount...

building a high scale java app, what stack would you use?

if you needed to build a highly scalable web application using java, what framework would you use and why? I'm just reading thinking-in-java, head first servlets and manning's spring framework boo, but really I want to focus on highly scalable architectures etc. would you use tomcat, hibernate, ehcache? (just assume you have to design...

Number of times an entity is viewed

How do you track the number of times a particular entity (say a user profile much similar to stackoverflow.com) is viewed by other users? Would it make sense to update this information when an entity is viewed using a lifecycle event like PostLoad. Where would you store the number of times the entity has been viewed, would it be in the ...

Session class in NetBeans IDE6.7

can we use Session class in Netbeans IDE 6.7.do we have to include any package for it.also if anybody can provide a sample example related to this question. ...

Hibernate Criteria returns children multiple times with FetchType.EAGER

I have an Order class that has a list of OrderTransactions and I mapped it with a one-to-many Hibernate mapping like so: @OneToMany(targetEntity = OrderTransaction.class, cascade = CascadeType.ALL) public List<OrderTransaction> getOrderTransactions() { return orderTransactions; } These Order's also have a field orderStatus that ar...