1 22 package org.jboss.ejb.plugins.cmp.jdbc.bridge; 23 24 import org.jboss.ejb.EntityEnterpriseContext; 25 import org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager; 26 import org.jboss.ejb.plugins.cmp.jdbc.JDBCTypeFactory; 27 import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData; 28 import org.jboss.deployment.DeploymentException; 29 30 34 public class JDBCTimestampVersionFieldBridge extends JDBCCMP2xVersionFieldBridge 35 { 36 public JDBCTimestampVersionFieldBridge(JDBCStoreManager manager, 37 JDBCCMPFieldMetaData metadata) 38 throws DeploymentException 39 { 40 super(manager, metadata); 41 checkDirtyAfterGet = false; 42 stateFactory = JDBCTypeFactory.EQUALS; 43 } 44 45 public JDBCTimestampVersionFieldBridge(JDBCCMP2xFieldBridge cmpField) 46 throws DeploymentException 47 { 48 super(cmpField); 49 checkDirtyAfterGet = false; 50 stateFactory = JDBCTypeFactory.EQUALS; 51 } 52 53 public void setFirstVersion(EntityEnterpriseContext ctx) 54 { 55 Object version = new java.util.Date (); 56 setInstanceValue(ctx, version); 57 } 58 59 public Object updateVersion(EntityEnterpriseContext ctx) 60 { 61 Object next = new java.util.Date (); 62 setInstanceValue(ctx, next); 63 return next; 64 } 65 } 66 | Popular Tags |