-->
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.  [ 1 post ] 
Author Message
 Post subject: saveOrUpdateCopy can save a new. but saveOrUpdate can't. why
PostPosted: Mon Mar 14, 2005 9:46 pm 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
saveOrUpdateCopy can save a new Object, but
saveOrUpdate can't save a new object? why?

public void testSaveOrUpdate() {

PigeonholeType pigeonholeType = new PigeonholeType();
pigeonholeType.setSymbol("none");
PigeonholeRule pigeonholeRule = new PigeonholeRule();
pigeonholeRule.setXtypeSymbol("SB006");
pigeonholeRule.setSize(new Integer(0));
pigeonholeRule.setPigeonholeType(pigeonholeType);
pigeonholeRuleDao.saveOrUpdate(pigeonholeRule);

}

public Serializable saveOrUpdate(PigeonholeRule obj)
throws HibernateException
{
session = sessionFactory.openSession();
x = session.beginTransaction();
session.saveOrUpdateCopy(obj);
tx.commit();

}

[WARN ] [2005-03-14 11:28:01,750] net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/WORK/fjky-fzgs/project/web/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Hibernate: update PIGEONHOLE_RULE set PIGEONHOLE_TYPE_SYMBOL=?, SIZE=? where XTYPE_SYMBOL=?
[ERROR] [2005-03-14 11:28:03,640] net.sf.hibernate.impl.SessionImpl - Could not synchronize database state with session
org.springframework.orm.hibernate.HibernateSystemException: Batch update row count wrong: 0; nested exception is net.sf.hibernate.HibernateException: Batch update row count wrong: 0
net.sf.hibernate.HibernateException: Batch update row count wrong: 0
Hibernate: select pigeonhole0_.XTYPE_SYMBOL as x0_0_ from PIGEONHOLE_RULE pigeonhole0_ where ((pigeonhole0_.XTYPE_SYMBOL=? ))



=============SQLs========================

create table xtype (
symbol varchar(16) not null,
title varchar(30) default 'no title' not null,
note varchar(256),

primary key(symbol)
);


create table pigeonhole_type ( symbol varchar(16) not null,
title varchar(32) not null,
primary key(symbol)
);


create table pigeonhole_rule (
xtype_symbol varchar(16) not null,
pigeonhole_type_symbol varchar(16),
size integer default 1,
primary key(xtype_symbol),
foreign key(xtype_symbol) references xtype(symbol),
foreign key(pigeonhole_type_symbol) references pigeonhole_type(symbol)
);

_________________
I am the creatxr of world.


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

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.