hibernate

Hibernate, Persistance and delation of associations.

Hello, I have some problem with delation of associations, this is my code : Classe ModuleVersion @ManyToMany(mappedBy="listModuleVersions") private List<SuiteVersion> suiteVersions = new ArrayList<SuiteVersion>(); Classe SuiteVersion @ManyToMany() private List<ModuleVersion> listModuleVersions = new ArrayList<ModuleVersion>...

Hibernate firing insert and update on saving a new entity

Hi All, I am using hibernate as ORM for my application. I am doing a saveOrUpdate on an Entity. When I check the queries fired . I can see 2 of them 1)Insert into... 2)Update... where id =? and version =? is this because of version , or this is regular hibernate behavior .. Since this is going to have Performance impact. I am using i...

java.lang.NullPointerException in a sample program of Hibernate

i am try to run a sample application of hibernate, it give me a error on run time: log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NullPointerException at transaction.rollback(); this is in Main....

org.hibernate.HibernateException in a basic program of Hibernate

i am using MySQL workbench 5.2 CE database with a basic hibernate program at run time it give me error: Caused by: org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver this code in hibernate.cfg.xml: <hibernate-configuration> <session-factory> <property name="dialect">org.hibernate.dial...

How would I map a map of maps of lists in hibernate?

The title is pretty complicated so I'll try and explain it: We have products that have several language dependent images of different types. Of each type there may be multiple images in an ordered list. So, in Java I'd express it like this: Map<String, Map<Long, List<Image>> images; Where the key of the first map is the language cod...

Getting Database connection in pure JPA setup

We have a JPA application (using hibernate) and we need to pass a call to a legacy reporting tool that needs a JDBC database connection as a parameter. Is there a simple way to get access to the JDBC connection hibernate has setup? ...

when saveorUpdate, an Error "a different object with the same identifier value was already associated with the session"

Using Hibernate, I'm facing an exception saying a different object with the same identifier value was already associated with the session. I don't know what's the cause of this exception and how to deal with it? If someone knows please teach me, thanks. And next is a part of my code, public void addRoleToUser(String userLogin, RoleBe...

unexpected sublist result returned by Hibernate query

Hi, I hava a HQL query as the following which returns a java.util.RandomAccessSubList of ORDER. The offset of the SubList is 1,so the first element of the query result list can't be accessed. SELECT vendor.order FROM OrderVendor vendor WHERE vendor.user.id=? ORDER BY vendor.order.creationTime desc select order1_.order_id as order1_18_...

How to build a change tracking system - not audit system

I have a requirement in which I need to capture data changes (not auditing) and life cycle states on inventory. Technology: Jave, Oracle, Hibernate + JPA For the data changes, we have been given a list of data elements that are to be monitored. If the element changes we are to notify a given 3rd party vendor. What I want to do is mak...

SQL , insert is possible on the table which is not present in terms of hibernate

does insert query in hibernate requires table to be present. I mean when i have a query that insert some values in to the table which is not present . will the hibernate gives the exception or it will through the exception only when update is done . I'm speaking in terms of only hibernate . Can you please suggest ...

Hibernate.Envers: @Audited at @ManyToOne throws Exception

Hi, there are following two classes, related by manytoone-annotation: @Entity public class Firma { @Id @GeneratedValue private int id; @OneToMany(mappedBy = "firma") private List<Mitarbeiter> mitarbeiter; //getter und setter methods } @Entity public class Mitarbeiter { @Id @GeneratedValue private int id; @Audite...

Hibernate:: query.list always contains the records of the first entry of the list

In the Database: TIMESTAMP DEVICE_ID SRC_ADDR PKTS_FWDED ------------------------------------------- 2010-08-10 11:45:07.547 4 2887253771 3 2010-08-10 11:45:09.547 4 2887253771 18 output of Hibernate: TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID: 4 SRC_ADDR: 2887253771 PKTS_FWDED 3 TIMESTAMP = 2010-08-10 11:45:07.547 DEVICE_ID...

Hibernate GWT integration throws "java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z"

Hello, This error is a nightmare, I have not been able to figure out why Hibernate libraries are not loaded into the classpath during the deploy onto the webserver( eclipse integrated Jetty server, bundled with GWT).I see that hibernate-jpa-2.0-api-1.0.0.Final.jar being added to the web app classpath at deploy time.But, still it is not ...

JSF 2.0 and Hibernate error

Hi, I deployed my application to the official server and started getting this error: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401) org.apache.jasper.servlet.JspServlet.serviceJspFile(Jsp...

Java Hibernate HQL queries with nolock

Is there a way to run these queries as if I added a (NOLOCK) hint to them? ...

What is hibernate in simple language ?

Hi, I'm a newbie. I keep seeing questions on hibernate on this site. I know how DBMS works and how to make an application talk to it. Help me understand what hibernate is. ...

Hibernate mapping for a table with no primary key

I know this question has been asked before but I have a design question as well. There are two tables like so: Table Group_table column pk_Group_name column group_type etc Table Group_members column fk_group_name -> foreign key to group_table column group_member It's easy to work with this structure but I have two questions. First,...

org.hibernate.HibernateException in a basic hibernate program

I get the following error session.save(student); org.hibernate.HibernateException: The database returned no natively generated identity value Here is main function { BasicConfigurator.configure(); Session session = HibernateUtil.getSessionFactory().openSession(); Transaction transaction = null; try { transaction = session...

What is the best eBook for a Hibernate beginner?

What is the best eBook for a beginner in Hibernate? ...

Inheritance in hibernate

I would like to implement inheritance in Hibernate. I created ObjectClass object: @Entity @Table(name = "object") @Inheritance(strategy = InheritanceType.JOINED) public class ObjectClass { private id; } and CodeTable object that inhertance Object class: @Entity @ForeignKey(name = "id") @Table(name = "code_table") public class ...