Skip to content

Instantly share code, notes, and snippets.

@stliu
Created August 10, 2012 06:59
Show Gist options
  • Save stliu/3312027 to your computer and use it in GitHub Desktop.
Save stliu/3312027 to your computer and use it in GitHub Desktop.
Session session = openSession();
session.beginTransaction();
SoundSystem system = new SoundSystem();
system.setId( "a" );
system.setBrand( "brand1" );
system.setModel( "model1" );
session.persist( system );
session.getTransaction().commit();
session.close();
session = openSession();
session.beginTransaction();
SoundSystem system1 = new SoundSystem();
system1.setId( "a" );
system1.setBrand( "brand2" );
session.saveOrUpdate( system1 );
session.getTransaction().commit();
session.close();
-------------
14:59:09,749 DEBUG SQL:104 -
insert
into
SoundSystem
(brand, model, id)
values
(?, ?, ?)
Hibernate:
insert
into
SoundSystem
(brand, model, id)
values
(?, ?, ?)
14:59:09,828 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - brand1
14:59:09,829 TRACE BasicBinder:83 - binding parameter [2] as [VARCHAR] - model1
14:59:09,829 TRACE BasicBinder:83 - binding parameter [3] as [VARCHAR] - a
14:59:09,841 DEBUG SQL:104 -
select
soundsyste_.id,
soundsyste_.brand as brand10_,
soundsyste_.model as model10_
from
SoundSystem soundsyste_
where
soundsyste_.id=?
Hibernate:
select
soundsyste_.id,
soundsyste_.brand as brand10_,
soundsyste_.model as model10_
from
SoundSystem soundsyste_
where
soundsyste_.id=?
14:59:09,842 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - a
14:59:09,879 TRACE BasicExtractor:72 - Found [brand1] as column [brand10_]
14:59:09,880 TRACE BasicExtractor:72 - Found [model1] as column [model10_]
14:59:09,888 DEBUG SQL:104 -
update
SoundSystem
set
brand=?,
model=?
where
id=?
Hibernate:
update
SoundSystem
set
brand=?,
model=?
where
id=?
14:59:09,888 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - brand2
14:59:09,889 TRACE BasicBinder:71 - binding parameter [2] as [VARCHAR] - <null>
14:59:09,889 TRACE BasicBinder:83 - binding parameter [3] as [VARCHAR] - a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment