-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problems with persisting objects to database
PostPosted: Wed Sep 29, 2004 8:08 am 
Newbie

Joined: Mon Sep 20, 2004 4:30 am
Posts: 2
Hi,

I have problems in persisting objects to the database. Not all objects in my application are having this problem just a few of them. And the most discussing thing is that earlier they did not have this problem.
The effect occures with insert and update.

Im developing with different connection to the database but all of them have the same rights. And just to be sure I tried also the other database usersaccount with no success.

I should mention that I'm using Spring Framework in my project.

Thanks in advance for your help!

Hibernate version: 2.1.6

Code between sessionFactory.openSession() and session.close():
SpringContextAccessor springCtxAccessor = new SpringContextAccessor();

AccountabilityService accountService = (AccountabilityService) springCtxAccessor.aquireBean(ACCOUNTABILITY_SERVICE, data);
CriteriaService criteriaService = (CriteriaService) springCtxAccessor.aquireBean(CRITERIA_SERVICE, data);
CriteriaTracker criteriaTracker = criteriaService.getTracker();

LOGGER.debug("-------- BEGIN UPDATE --------");

Criteria criteria = criteriaTracker.findByPrimaryKey(data.getParameters().getLong("criteriaId"));

CustomerGroup customerGroup = accountService.getTracker().findGroupByPrimaryKey(data.getParameters().getLong("customerGroupId"));
if (customerGroup != null) {
criteria.setCustomerGroup(customerGroup);
}
criteria.setDescription(data.getParameters().getString("description"));

criteriaService.update(criteria);

LOGGER.debug("-------- END UPDATE --------");

Name and version of the database you are using: PostgreSQL 7.4.3

Spring version: 1.0.2

Debug level Hibernate log excerpt:
[2004-09-29 14:03:23,993] DEBUG application.modules.actions.backoffice.survey.CriteriaAction - -------- BEGIN UPDATE --------
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.SessionImpl - loading [application.domain.model.transaction.selection.Criteria#6]
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.SessionImpl - loading [application.domain.model.master.CustomerGroup#1]
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.SessionImpl - attempting to resolve [application.domain.model.master.CustomerGroup#1]
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.SessionImpl - object not resolved in any cache [application.domain.model.master.CustomerGroup#1]
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.persister.EntityPersister - Materializing entity: [application.domain.model.master.CustomerGroup#1]
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.SQL - select customergr0_.id as id0_, customergr0_.REVISION as REVISION0_, customergr0_.NAME as NAME0_ from CUSTOMER_GROUP customergr0_ where customergr0_.id=?
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
[2004-09-29 14:03:23,993] DEBUG net.sf.hibernate.type.LongType - binding '1' to parameter: 1
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.loader.Loader - processing result set
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.loader.Loader - result row: 1
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 1
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: application.domain.model.master.CustomerGroup#1
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.type.LongType - returning '16' as column: REVISION0_
[2004-09-29 14:03:24,003] DEBUG net.sf.hibernate.type.StringType - returning '


Top
 Profile  
 
 Post subject: Problem solved
PostPosted: Wed Sep 29, 2004 9:33 am 
Newbie

Joined: Mon Sep 20, 2004 4:30 am
Posts: 2
Ok, the problem is solved.
There was a configuration problem in the applicationContext.xml. I forgot to register the appropriate service which handles the save and update. So it was a Spring-Config prob and not a Hibernate problem.

Holger.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.