Created
June 4, 2010 18:21
-
-
Save making/425763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import jp.sf.amateras.mirage.annotation.PrimaryKey; | |
public class Category { | |
@PrimaryKey | |
public Long id; | |
public String name; | |
public Long sequence; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdbc.driver=com.mysql.jdbc.Driver | |
jdbc.url=jdbc:mysql://localhost/blog | |
jdbc.user=root | |
jdbc.password= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import jp.sf.amateras.mirage.SqlManager; | |
import jp.sf.amateras.mirage.session.Session; | |
import jp.sf.amateras.mirage.session.SessionFactory; | |
import org.apache.commons.lang.builder.ToStringBuilder; | |
public class Sample { | |
public static void main(String[] args) throws Exception { | |
Session session = SessionFactory.getSession(); | |
SqlManager sqlManager = session.getSqlManager(); | |
session.begin(); | |
try { | |
Category category = sqlManager.findEntity(Category.class, 104); | |
System.out.println(ToStringBuilder.reflectionToString(category)); | |
} finally { | |
session.release(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment