Further progress on the ORM stuff. Miraculously, upon running this nearly

thousand lines of super funny looking generics and reflection filled code the
first time, it just worked. Yay for static typing or something.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@1909 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-09-15 01:48:29 +00:00
parent 9ed739ba61
commit a755572474
5 changed files with 311 additions and 97 deletions
@@ -0,0 +1,33 @@
//
// $Id$
package com.samskivert.jdbc.depot;
import java.sql.Date;
import java.sql.Timestamp;
import javax.persistence.Id;
import com.samskivert.util.StringUtil;
/**
* A test persistent object.
*/
public class TestRecord
{
@Id
public int recordId;
public String name;
public int age;
public Date created;
public Timestamp lastModified;
public String toString ()
{
return StringUtil.fieldsToString(this);
}
}
@@ -0,0 +1,38 @@
//
// $Id$
package com.samskivert.jdbc.depot;
import java.sql.Date;
import java.sql.Timestamp;
import com.samskivert.jdbc.ConnectionProvider;
import com.samskivert.jdbc.StaticConnectionProvider;
/**
* A test tool for the Depot repository services.
*/
public class TestRepository extends DepotRepository
{
public static void main (String[] args)
throws Exception
{
TestRepository repo = new TestRepository(
new StaticConnectionProvider("depot.properties"));
TestRecord record = new TestRecord();
record.name = "Elvis";
record.age = 99;
record.created = new Date(System.currentTimeMillis());
record.lastModified = new Timestamp(System.currentTimeMillis());
repo.insert(record);
System.out.println(repo.load(TestRecord.class, record.recordId));
}
public TestRepository (ConnectionProvider conprov)
{
super(conprov);
}
}