Package com.google.appengine.datanucleus.test.jpa

Examples of com.google.appengine.datanucleus.test.jpa.HasTimestampVersionJPA


  /**
   * Tests the use of a java.sql.Timestamp field for versioning.
   */
  public void testTimestampVersion() {
    beginTxn();
    HasTimestampVersionJPA tv = new HasTimestampVersionJPA();
    tv.setValue("First Value");
    em.persist(tv);
    commitTxn();
    Timestamp firstVersion = tv.getVersion();
    Assert.assertNotNull(firstVersion);

    beginTxn();
    tv.setValue("Second Value");
    commitTxn();
    Timestamp secondVersion = tv.getVersion();
    Assert.assertNotNull(secondVersion);
    long firstMillis = firstVersion.getTime();
    long secondMillis = secondVersion.getTime();
    Assert.assertTrue(secondMillis > firstMillis);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.datanucleus.test.jpa.HasTimestampVersionJPA

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.