Package nexj.core.meta.persistence.sql

Examples of nexj.core.meta.persistence.sql.RelationalPrimitiveMapping


         Object obj = instance.getValueDirect(m_variablesAttribute.getOrdinal());

         if (!(obj instanceof Undefined))
         {
            RelationalMapping mapping = (RelationalMapping)instance.getPersistenceMapping();
            RelationalPrimitiveMapping attrMapping = (RelationalPrimitiveMapping)mapping
               .getAttributeMapping(m_serializedVariablesAttribute);

            SQLWork work = (SQLWork)adapter.addPrimitiveWork(uow, instance,
               adapter.findWork(uow, instance, mapping.getPrimaryTable()),
               attrMapping, (obj == null) ? null : "");

            if (work != null)
            {
               work.setValue(attrMapping.getColumn(), null);

               if (obj instanceof SerializablePropertyMap)
               {
                  Holder identitySet = null;
View Full Code Here


   {
      setValue(column, value);

      if (m_mappingArray != null)
      {
         RelationalPrimitiveMapping mapping = m_mappingArray[column.getOrdinal()];

         if (mapping != null)
         {
            Attribute attribute = mapping.getAttribute();

            m_instance.setValueDirect(attribute.getOrdinal(), ((Primitive)attribute.getType()).convert(value));
         }
      }
   }
View Full Code Here

      assertNotNull(hrRequestMapping);
      assertNotNull(hrRequestMapping.getLockingAttribute());
      assertEquals("version", hrRequestMapping.getLockingAttribute().getName());

      RelationalPrimitiveMapping versionMapping =
         (RelationalPrimitiveMapping)hrRequestMapping.getAttributeMapping(m_hrRequest.getAttribute("version"));

      assertNotNull(versionMapping);
      assertEquals("version", versionMapping.getColumn().getName());
      assertEquals("test.HRRequest", versionMapping.getColumn().getTable().getName());

      RelationalMapping principalRefMapping = (RelationalMapping)m_principalRef.getPersistenceMapping();

      assertNotNull(principalRefMapping);
      assertNotNull(principalRefMapping.getLockingAttribute());
      assertEquals("version", principalRefMapping.getLockingAttribute().getName());

      versionMapping = (RelationalPrimitiveMapping)principalRefMapping
         .getAttributeMapping(m_principalRef.getAttribute("version"));

      assertNotNull(versionMapping);
      assertEquals("version", versionMapping.getColumn().getName());
      assertEquals("PrincipalRef", versionMapping.getColumn().getTable().getName());

      RelationalClassMapping principalMapping = (RelationalClassMapping)principalRefMapping
         .getAttributeMapping(m_principalRef.getAttribute("principal"));

      assertNotNull(principalMapping);
      assertEquals("PrincipalRef.FK_Usr", principalMapping.getSourceKey().getName());
      assertEquals("Usr.PK", ((Index)principalMapping.getDestinationKey()).getName());
      assertEquals(1, principalMapping.getDenormCount());
      assertEquals("PrincipalExt.FK_Usr", ((RelationalClassDenorm)principalMapping.getDenorm(0)).getSourceKey().getName());

      principalMapping = (RelationalClassMapping)principalRefMapping
         .getAttributeMapping(m_principalRef.getAttribute("principal2"));

      assertNotNull(principalMapping);
      assertEquals("PrincipalRef.PK", principalMapping.getSourceKey().getName());
      assertEquals("Usr.PK", ((Index)principalMapping.getDestinationKey()).getName());
      assertEquals(0, principalMapping.getDenormCount());

      RelationalPrimitiveMapping principalIdMapping = (RelationalPrimitiveMapping)principalRefMapping
         .getAttributeMapping(m_principalRef.getAttribute("principalId"));

      assertNotNull(principalIdMapping);
      assertEquals("principalId", principalIdMapping.getColumn().getName());
      assertEquals("PrincipalRef", principalIdMapping.getColumn().getTable().getName());
   }
View Full Code Here

    */
   protected Work addPrimitiveWork(UnitOfWork uow, Instance instance,
      Work primaryWork, AttributeMapping attributeMapping, Object value)
   {
      RelationalMapping mapping = (RelationalMapping)instance.getPersistenceMapping();
      RelationalPrimitiveMapping primitiveMapping = (RelationalPrimitiveMapping)attributeMapping;
      Column column = primitiveMapping.getColumn();
      int nType = primaryWork.getType();
      SQLWork work = null;

      if (nType == SQLWork.UPDATE || value != null || column.getTable() == mapping.getPrimaryTable())
      {
View Full Code Here

    * @param field The field.
    * @param columnSet The destination column set.
    */
   protected void addColumns(Field field, Set columnSet)
   {
      RelationalPrimitiveMapping mapping = (RelationalPrimitiveMapping)field.getAttributeMapping();

      if (mapping != null)
      {
         columnSet.add(mapping.getColumn());
      }
      else
      {
         Object item = field.getItem();

View Full Code Here

   {
      if (source instanceof Field)
      {
         Column column = null;
         Field field = (Field)source;
         RelationalPrimitiveMapping mapping = (RelationalPrimitiveMapping)field.getAttributeMapping();

         if (mapping != null)
         {
            column = mapping.getColumn();
         }
         else if (field.getItem() instanceof Column)
         {
            column = (Column)field.getItem();
         }
View Full Code Here

      }

      if (source instanceof Field)
      {
         Column column = null;
         RelationalPrimitiveMapping primitiveMapping = (RelationalPrimitiveMapping)source.getAttributeMapping();

         if (primitiveMapping != null)
         {
            column = primitiveMapping.getColumn();
         }
         else
         {
            Object item = source.getItem();
View Full Code Here

TOP

Related Classes of nexj.core.meta.persistence.sql.RelationalPrimitiveMapping

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.