hi, I noticed that when it comes to lifecycle callbacks I can only
reliably use beforeInsert and afterInsert. beforeUpdate is called only
with initial insert, and no update related callbacks are called when
updating existing row. also delete related callbacks won't fire.
I'm not very experienced squeryl user, so it can be that I'm missing
some important point, may be that my setup is flawed (I mean,
build.sbt ??), or maybe lifecycle functionality is just not yet fully
supported as I understand it's a new feature. please let me know.
here I prepared a simple LIFT app that demonstrates the problem:
g...@github.com:oolekk/sqrlrcrd.com.git
this is what I get, when running this app - update & delete callbacks
don't fire as expected when using either h2 or mysql (tried to check
postgres too, but I had some trouble connecting to my local postgres
db, perhaps wrong URL or access permissions)
17:03:57.533 [pool-6-thread-1] DEBUG c.s.m.MySchemaHelper
$MyH2DBSettings - MyH2DBSettings: seting adapter=H2Adapter
driver=org.h2.Driver
url=jdbc:h2:mem:sqrlrcrd_com;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=3000
user=test pw=
17:03:57.535 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchemaHelper
- initSquerylRecord with DBSettings: driver=org.h2.Driver
url=jdbc:h2:mem:sqrlrcrd_com;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=3000
user=test pw=
17:03:57.985 [pool-6-thread-1] WARN com.jolbox.bonecp.BoneCPConfig -
Max Connections < 1. Setting to 20
17:03:59.353 [pool-6-thread-1] INFO c.s.m.MySchemaHelper$PoolProvider
- BoneCP connection pool is now initialized.
-- table declarations :
create table msr (
name varchar(100) not null,
id bigint not null primary key auto_increment
);
17:04:00.327 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData -
about to insert foo & bar
17:04:00.426 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeInsert
17:04:00.428 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeUpdate
17:04:00.428 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeInsert
17:04:00.428 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeUpdate
17:04:00.463 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeInsert
17:04:00.463 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeUpdate
17:04:00.467 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeInsert
17:04:00.471 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeUpdate
17:04:00.482 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
afterInsert
17:04:00.482 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
afterInsert
17:04:00.497 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData - foo
& bar inserted
17:04:00.499 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData -
about to insert baz
17:04:00.506 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeInsert
17:04:00.507 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
beforeUpdate
17:04:00.567 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.MySchema -
afterInsert
17:04:00.580 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData - baz
inserted
17:04:00.582 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData -
about to update baz
17:04:00.675 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData - baz
updated
17:04:00.677 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData -
about to delete foo
17:04:00.744 [pool-6-thread-1] DEBUG com.sqrlrcrd.model.DemoData - foo
deleted
17:04:00.745 [pool-6-thread-1] INFO bootstrap.liftweb.Boot -
RunMode is DEVELOPMENT @
sqrlrcrd.com