MollyPages.org
"You were wrong case. To live here is to live." |
Pages /
Database /
Forms /
Servlet /
Javadocs
/
License & Download /
Tutorials /
Cookbook
/
Contact & Hire
|
Once an object is saved, its isDiscarded flag is set to true and this object cannot be saved again. It must either be retrieved again from the database or a new independent object created and saved.
root@turing:/examples/dbo# java examples.dbo.Test -conf postgres.cnf -test examples.dbo.Save -loglevel debug INFO New log level set to: LogLevel [4,DEBUG] INFO fc.util.FilePropertyMgrLoaded properties from file: postgres.cnf DEBUG <init>() [FilePropertyMgr.java:35/thread:main] -- listing properties -- target.types_to_process=table generate.output.dir=. jdbc.password=mypassword target.tables_to_process=mollytest generate.class_package=examples.dbo jdbc.url=jdbc:postgresql://localhost/test jdbc.user=postgres jdbc.catalog=test jdbc.driver=org.postgresql.Driver DEBUG <init>() [ConnectionMgr.java:131/thread:main] ConnectionMgr constructor; driver=org.postgresql.Driver url=jdbc:postgresql://localhost/test user=postgres password=mypassword catalog=test DEBUG init() [PooledConnectionMgr.java:114/thread:main] PooledConnectionMgr.constructor: Constructed new connection pool buffer: [] DEBUG init() [PooledConnectionMgr.java:124/thread:main] PooledConnectionMgr.constructor: added 1 connections to the connection pool DEBUG getConnection() [ConnectionMgr.java:176/thread:main] fc.jdbc.PooledConnectionMgr [capacity=1; available=0]setting catalog name to: test DEBUG getConnection() [ConnectionMgr.java:179/thread:main] fc.jdbc.PooledConnectionMgr [capacity=1; available=0]returning connection=fc.jdbc.PooledConnection@42552c/PoolID:1 Creates a new bean representing a row in table mollytest and saves it. >>> Created a new bean Class Name: [mollytest] [isDiscarded=false] [isNew=true] [isModified=false] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 0 - - x - - name null - - - - - email null - - - - - password null - - - - - created_on null - - - - - is_active false - - - >>> Setting various values in the new bean >>> After setting values in the new bean Class Name: [mollytest] [isDiscarded=false] [isNew=true] [isModified=true] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 0 - - x - - name Molly Kolodny x - - - - email mol@holografix.net x - - - - password blue9 x - - - - created_on 2007-04-08 x - - - - is_active true x - - Now SAVING....(this should work)... DEBUG save() [mollytestMgr.java:732/thread:main] Query to run: INSERT into mollytest (name, email, password, created_on, is_active) values (Molly Kolodny, mol@holografix.net, blue9, 2007-04-08 -0400, 1) >>> Save successful >>> After saving the bean [Note: the serial/auto-increment uid is now available !] Class Name: [mollytest] [isDiscarded=true] [isNew=true] [isModified=true] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 1 x - x - - name Molly Kolodny x - - - - email mol@holografix.net x - - - - password blue9 x - - - - created_on 2007-04-08 x - - - - is_active true x - - JVM shutdown: fc.io.Log - closing all logs... test=# select * from mollytest; uid | name | email | password | created_on | is_active -----+---------------+--------------------+----------+------------+----------- 1 | Molly Kolodny | mol@holografix.net | blue9 | 2007-04-08 | t (1 row)
root@turing:/examples/dbo# java examples.dbo.Test -conf mysql.cnf -test examples.dbo.Save -loglevel debug INFO New log level set to: LogLevel [4,DEBUG] INFO fc.util.FilePropertyMgrLoaded properties from file: mysql.cnf DEBUG <init>() [FilePropertyMgr.java:35/thread:main] -- listing properties -- target.types_to_process=table generate.output.dir=. jdbc.password=mypassword target.tables_to_process=mollytest generate.class_package=examples.dbo jdbc.url=jdbc:mysql://localhost/?autoReconnect... jdbc.user=root jdbc.catalog=test jdbc.driver=com.mysql.jdbc.Driver DEBUG <init>() [ConnectionMgr.java:131/thread:main] ConnectionMgr constructor; driver=com.mysql.jdbc.Driver url=jdbc:mysql://localhost/?autoReconnect=true user=root password=mypassword catalog=test DEBUG init() [PooledConnectionMgr.java:114/thread:main] PooledConnectionMgr.constructor: Constructed new connection pool buffer: [] DEBUG init() [PooledConnectionMgr.java:124/thread:main] PooledConnectionMgr.constructor: added 1 connections to the connection pool DEBUG getConnection() [ConnectionMgr.java:176/thread:main] fc.jdbc.PooledConnectionMgr [capacity=1; available=0]setting catalog name to: test DEBUG getConnection() [ConnectionMgr.java:179/thread:main] fc.jdbc.PooledConnectionMgr [capacity=1; available=0]returning connection=fc.jdbc.PooledConnection@42552c/PoolID:1 Creates a new bean representing a row in table mollytest and saves it. >>> Created a new bean Class Name: [mollytest] [isDiscarded=false] [isNew=true] [isModified=false] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 0 - - x - - name null - - - - - email null - - - - - password null - - - - - created_on null - - - - - is_active false - - - >>> Setting various values in the new bean >>> After setting values in the new bean Class Name: [mollytest] [isDiscarded=false] [isNew=true] [isModified=true] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 0 - - x - - name Molly Kolodny x - - - - email mol@holografix.net x - - - - password blue9 x - - - - created_on 2007-04-08 x - - - - is_active true x - - Now SAVING....(this should work)... DEBUG save() [mollytestMgr.java:732/thread:main] Query to run: com.mysql.jdbc.PreparedStatement@5db314: INSERT into mollytest (name, email, password, created_on, is_active) values ('Molly Kolodny', 'mol@holografix.net', 'blue9', '2007-04-08', 1) >>> Save successful >>> After saving the bean [Note: the serial/auto-increment uid is now available !] Class Name: [mollytest] [isDiscarded=true] [isNew=true] [isModified=true] Note: IsNullInDB only meaningful for existing rows (i.e., isNew=false) PK FK Field Value isModified isNullinDB isSerial/AutoInc x - uid 1 x - x - - name Molly Kolodny x - - - - email mol@holografix.net x - - - - password blue9 x - - - - created_on 2007-04-08 x - - - - is_active true x - - JVM shutdown: fc.io.Log - closing all logs... mysql> select * from mollytest; +-----+---------------+--------------------+----------+------------+-----------+ | uid | name | email | password | created_on | is_active | +-----+---------------+--------------------+----------+------------+-----------+ | 1 | Molly Kolodny | mol@holografix.net | blue9 | 2007-04-08 | 1 | +-----+---------------+--------------------+----------+------------+-----------+ 1 row in set (0.00 sec)