This file contains 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
<hibernate-mapping> | |
<class name="com.montrosesoftware.dbassist.User" table="users"> | |
<id name="id" type="integer"> | |
<column name="id" /> | |
</id> | |
<property name="name" type="string" length="100" column="name"/> | |
<property name="createdAtUtc" type="timestamp" column="created_at_utc"/> | |
</class> | |
</hibernate-mapping> |
This file contains 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
public class User { | |
private int id; | |
private String name; | |
private java.util.Date createdAtUtc; | |
public User(int id, String name, java.util.Date createdAtUtc) { | |
this.id = id; | |
this.name = name; | |
this.createdAtUtc = createdAtUtc; | |
} |
This file contains 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
public class ReadDateZeroWithJDBC { | |
public static void main(String args[]) throws ClassNotFoundException, SQLException { | |
Connection conn = setupJDBCAndConnect(); | |
//expected epoch unix time | |
java.util.Date dateExpected = new java.util.Date(0); | |
//actual created_at_utc from the user record in DB | |
PreparedStatement stmtRead = createSelectStatement(conn, 1); | |
ResultSet rs = stmtRead.executeQuery(); |
NewerOlder