Package org.jboss.ejb.plugins.cmp.jdbc2.schema

Examples of org.jboss.ejb.plugins.cmp.jdbc2.schema.EntityTable


/* 273 */     return pctx.isDirty();
/*     */   }
/*     */
/*     */   public boolean isModified(EntityEnterpriseContext instance)
/*     */   {
/* 278 */     PersistentContext pctx = (PersistentContext)instance.getPersistenceContext();
/* 279 */     boolean modified = pctx.isDirty();
/*     */
/* 281 */     if ((!modified) && (this.cmrFields != null))
/*     */     {
/* 283 */       for (int i = 0; i < this.cmrFields.length; i++)
/*     */       {
/* 285 */         JDBCCMRFieldBridge2.FieldState cmrState = pctx.getCMRState(i);
/* 286 */         if ((cmrState == null) || (!cmrState.isModified()))
/*     */           continue;
/* 288 */         modified = true;
/* 289 */         break;
/*     */       }
View Full Code Here


/* 1033 */       return this.value;
/*      */     }
/*      */
/*      */     public void cacheValue(EntityEnterpriseContext ctx)
/*      */     {
/* 1038 */       PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/* 1039 */       pctx.cacheRelations(JDBCCMRFieldBridge2.this.cmrIndex, this);
/*      */     }
View Full Code Here

/* 1080 */       return this.value;
/*      */     }
/*      */
/*      */     private void loadOnlyFromCache(EntityEnterpriseContext ctx)
/*      */     {
/* 1085 */       PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/* 1086 */       if (pctx == null)
/*      */       {
/* 1088 */         throw new EJBException("Persistence context is not available! Make sure the CMR collection is accessed in the transaction it was obtained.");
/*      */       }
/* 1090 */       pctx.loadCachedRelations(JDBCCMRFieldBridge2.this.cmrIndex, this);
/*      */     }
View Full Code Here

/*  809 */       return this.value == null ? NULL_VALUE : this.value;
/*      */     }
/*      */
/*      */     public void cacheValue(EntityEnterpriseContext ctx)
/*      */     {
/*  814 */       PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/*  815 */       pctx.cacheRelations(JDBCCMRFieldBridge2.this.cmrIndex, this);
/*      */     }
View Full Code Here

/*      */
/*      */     private Object getLoadedValue(EntityEnterpriseContext ctx)
/*      */     {
/*  834 */       if (!this.loaded)
/*      */       {
/*  836 */         PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/*  837 */         pctx.loadCachedRelations(JDBCCMRFieldBridge2.this.cmrIndex, this);
/*  838 */         if (!this.loaded)
/*      */         {
/*  840 */           JDBCCMRFieldBridge2.this.loader.load(ctx, this);
/*  841 */           this.loaded = true;
/*  842 */           cacheValue(ctx);
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   private FieldState getFieldState(EntityEnterpriseContext ctx)
/*      */   {
/*  533 */     PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/*  534 */     FieldState state = pctx.getCMRState(this.cmrIndex);
/*  535 */     if (state == null)
/*      */     {
/*  537 */       if (isSingleValued())
/*      */       {
/*  539 */         state = new SingleValuedFieldState();
/*      */       }
/*      */       else
/*      */       {
/*  543 */         state = new CollectionValuedFieldState();
/*      */       }
/*  545 */       pctx.setCMRState(this.cmrIndex, state);
/*      */     }
/*  547 */     return state;
/*      */   }
View Full Code Here

/* 1440 */         JDBCCMRFieldBridge2.this.foreignKeyFields[i].setValueInternal(ctx, null, JDBCCMRFieldBridge2.this.fkConstraint == null);
/*      */       }
/*      */
/* 1443 */       if (JDBCCMRFieldBridge2.this.fkConstraint != null)
/*      */       {
/* 1445 */         PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/* 1446 */         pctx.nullForeignKey(JDBCCMRFieldBridge2.this.fkConstraint);
/*      */       }
/*      */     }
View Full Code Here

/* 1457 */         JDBCCMRFieldBridge2.this.foreignKeyFields[i].setValueInternal(ctx, fieldValue, markDirty);
/*      */       }
/*      */
/* 1460 */       if (JDBCCMRFieldBridge2.this.fkConstraint != null)
/*      */       {
/* 1462 */         PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/* 1463 */         if (relatedId == null)
/*      */         {
/* 1465 */           pctx.nullForeignKey(JDBCCMRFieldBridge2.this.fkConstraint);
/*      */         }
/*      */         else
/*      */         {
/* 1469 */           pctx.nonNullForeignKey(JDBCCMRFieldBridge2.this.fkConstraint);
/*      */         }
/*      */       }
/*      */     }
View Full Code Here

/* 152 */     throw new EJBException("Internal error setting instance field " + getFieldName(), e);
/*     */   }
/*     */
/*     */   public void setValueInternal(EntityEnterpriseContext ctx, Object value, boolean makeDirty)
/*     */   {
/* 158 */     PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/*     */
/* 161 */     if ((this.cmpFieldIAmMappedTo != null) && (this.cmpFieldIAmMappedTo.isPrimaryKeyMember))
/*     */     {
/* 163 */       Object curValue = pctx.getFieldValue(this.rowIndex);
/* 164 */       if ((value != null) && (!value.equals(curValue)))
/*     */       {
/* 166 */         throw new IllegalStateException("Attempt to modify a primary key field through a foreign key field mapped to it: " + this.entity.getEntityName() + "." + this.cmpFieldIAmMappedTo.getFieldName() + " -> " + this.entity.getQualifiedTableName() + "." + this.cmpFieldIAmMappedTo.getColumnName() + ", current value=" + curValue + ", new value=" + value);
/*     */       }
/*     */
/* 181 */       makeDirty = false;
/*     */     }
/*     */     else
/*     */     {
/* 185 */       pctx.setFieldValue(this.rowIndex, value);
/*     */     }
/*     */
/* 188 */     if (makeDirty)
/*     */     {
/* 190 */       pctx.setDirty();
/*     */     }
/*     */   }
View Full Code Here

/* 399 */     return this.fieldName;
/*     */   }
/*     */
/*     */   public Object getValue(EntityEnterpriseContext ctx)
/*     */   {
/* 404 */     PersistentContext pctx = (PersistentContext)ctx.getPersistenceContext();
/* 405 */     return pctx.getFieldValue(this.rowIndex);
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.jdbc2.schema.EntityTable

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.