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.metadata.JDBCCMPFieldMetaData; 27 import org.jboss.deployment.DeploymentException; 28 29 33 public class JDBCLongVersionFieldBridge extends JDBCCMP2xVersionFieldBridge 34 { 35 private static final Long FIRST_VERSION = new Long (1); 36 37 public JDBCLongVersionFieldBridge(JDBCStoreManager manager, 38 JDBCCMPFieldMetaData metadata) 39 throws DeploymentException 40 { 41 super(manager, metadata); 42 } 43 44 public JDBCLongVersionFieldBridge(JDBCCMP2xFieldBridge cmpField) 45 throws DeploymentException 46 { 47 super(cmpField); 48 } 49 50 public void setFirstVersion(EntityEnterpriseContext ctx) 51 { 52 setInstanceValue(ctx, FIRST_VERSION); 53 } 54 55 public Object updateVersion(EntityEnterpriseContext ctx) 56 { 57 final Long value = (Long )getInstanceValue(ctx); 58 Long next = value == null ? FIRST_VERSION : new Long (value.longValue() + 1); 59 setInstanceValue(ctx, next); 60 return next; 61 } 62 } 63 | Popular Tags |