com.caucho.amber.field
Class CompositeId

java.lang.Object
  extended by com.caucho.amber.field.Id
      extended by com.caucho.amber.field.CompositeId
Direct Known Subclasses:
EmbeddedId

public class CompositeId
extends Id

Configuration for a bean's field


Constructor Summary
protected CompositeId(EntityType ownerType)
           
  CompositeId(EntityType ownerType, java.util.ArrayList<IdField> keys)
           
 
Method Summary
 java.lang.String generateCastFromObject(java.lang.String value)
          Generates code to convert to the type from the object.
 void generateCheckCreateKey(JavaWriter out)
          Generates the set clause.
 java.lang.String generateCreateTableSQL(AmberPersistenceUnit manager)
          Generates the where clause.
 java.lang.String generateEquals(java.lang.String leftBase, java.lang.String value)
          Generates code to test the equals.
 java.lang.String generateGet(java.lang.String value)
          Returns the key for the value
 java.lang.String generateGetProxyProperty(java.lang.String value)
          Returns the key for the value
 java.lang.String generateJavaSelect(java.lang.String id)
          Generates the JPA QL select clause.
 int generateLoadForeign(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index)
          Returns the foreign type.
 int generateLoadForeign(JavaWriter out, java.lang.String rs, java.lang.String indexVar, int index, java.lang.String name)
          Returns the foreign type.
 void generateLoadFromObject(JavaWriter out, java.lang.String obj)
          Generates loading cache
 java.lang.String generateLoadSelect(java.lang.String id)
          Generates the select clause.
 void generateMatch(JavaWriter out, java.lang.String key)
          Generates code for a match.
 void generatePrologue(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet)
          Generates any prologue.
 void generatePrologue(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet, java.lang.String name)
          Generates any prologue.
 void generatePrologueLoad(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet)
          Generates any prologue.
 void generatePrologueMake(JavaWriter out, java.util.HashSet<java.lang.Object> completedSet)
          Generates any prologue.
 java.lang.String generateSelect(java.lang.String id)
          Generates the select clause.
 void generateSet(JavaWriter out, java.lang.String objThis, java.lang.String value)
          Generates loading cache
 void generateSetKey(JavaWriter out, java.lang.String pstmt, java.lang.String obj, java.lang.String index)
          Generates the set clause.
 void generateUpdateFromObject(JavaWriter out, java.lang.String obj)
          Generates loading cache
 java.lang.String generateWhere(java.lang.String id)
          Generates the where clause.
 java.lang.String getForeignMakeKeyName()
          Returns the foreign type.
 java.lang.String getForeignTypeName()
          Returns the foreign type.
 void setKeyClass(java.lang.Class keyClass)
          Sets the foreign key type.
 java.lang.String toObject(java.lang.String value)
          Generates code to convert to the object.
 
Methods inherited from class com.caucho.amber.field.Id
addKey, generateCopy, generateGetProxyKey, generateMatchArgWhere, generateRawWhere, generateSet, generateSetGeneratedKeys, generateSetInsert, generateStatementSet, getColumns, getEmbeddedIdField, getGeneratedIdField, getKey, getKeyCount, getKeys, getObject, getOwnerType, init, isEmbeddedId, isIdentityGenerator, toObjectKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeId

public CompositeId(EntityType ownerType,
                   java.util.ArrayList<IdField> keys)

CompositeId

protected CompositeId(EntityType ownerType)
Method Detail

setKeyClass

public void setKeyClass(java.lang.Class keyClass)
Sets the foreign key type.


getForeignTypeName

public java.lang.String getForeignTypeName()
Returns the foreign type.

Overrides:
getForeignTypeName in class Id

getForeignMakeKeyName

public java.lang.String getForeignMakeKeyName()
Returns the foreign type.


generatePrologue

public void generatePrologue(JavaWriter out,
                             java.util.HashSet<java.lang.Object> completedSet)
                      throws java.io.IOException
Generates any prologue.

Overrides:
generatePrologue in class Id
Throws:
java.io.IOException

generatePrologue

public void generatePrologue(JavaWriter out,
                             java.util.HashSet<java.lang.Object> completedSet,
                             java.lang.String name)
                      throws java.io.IOException
Generates any prologue.

Overrides:
generatePrologue in class Id
Throws:
java.io.IOException

generatePrologueMake

public void generatePrologueMake(JavaWriter out,
                                 java.util.HashSet<java.lang.Object> completedSet)
                          throws java.io.IOException
Generates any prologue.

Throws:
java.io.IOException

generatePrologueLoad

public void generatePrologueLoad(JavaWriter out,
                                 java.util.HashSet<java.lang.Object> completedSet)
                          throws java.io.IOException
Generates any prologue.

Throws:
java.io.IOException

generateLoadForeign

public int generateLoadForeign(JavaWriter out,
                               java.lang.String rs,
                               java.lang.String indexVar,
                               int index)
                        throws java.io.IOException
Returns the foreign type.

Overrides:
generateLoadForeign in class Id
Throws:
java.io.IOException

generateLoadForeign

public int generateLoadForeign(JavaWriter out,
                               java.lang.String rs,
                               java.lang.String indexVar,
                               int index,
                               java.lang.String name)
                        throws java.io.IOException
Returns the foreign type.

Overrides:
generateLoadForeign in class Id
Throws:
java.io.IOException

generateSelect

public java.lang.String generateSelect(java.lang.String id)
Generates the select clause.

Overrides:
generateSelect in class Id

generateJavaSelect

public java.lang.String generateJavaSelect(java.lang.String id)
Generates the JPA QL select clause.

Overrides:
generateJavaSelect in class Id

generateLoadSelect

public java.lang.String generateLoadSelect(java.lang.String id)
Generates the select clause.

Overrides:
generateLoadSelect in class Id

generateGet

public java.lang.String generateGet(java.lang.String value)
Returns the key for the value

Overrides:
generateGet in class Id

generateSet

public void generateSet(JavaWriter out,
                        java.lang.String objThis,
                        java.lang.String value)
                 throws java.io.IOException
Generates loading cache

Overrides:
generateSet in class Id
Throws:
java.io.IOException

generateGetProxyProperty

public java.lang.String generateGetProxyProperty(java.lang.String value)
Returns the key for the value


generateLoadFromObject

public void generateLoadFromObject(JavaWriter out,
                                   java.lang.String obj)
                            throws java.io.IOException
Generates loading cache

Overrides:
generateLoadFromObject in class Id
Throws:
java.io.IOException

generateUpdateFromObject

public void generateUpdateFromObject(JavaWriter out,
                                     java.lang.String obj)
                              throws java.io.IOException
Generates loading cache

Overrides:
generateUpdateFromObject in class Id
Throws:
java.io.IOException

generateWhere

public java.lang.String generateWhere(java.lang.String id)
Generates the where clause.


generateCreateTableSQL

public java.lang.String generateCreateTableSQL(AmberPersistenceUnit manager)
Generates the where clause.

Overrides:
generateCreateTableSQL in class Id

generateSetKey

public void generateSetKey(JavaWriter out,
                           java.lang.String pstmt,
                           java.lang.String obj,
                           java.lang.String index)
                    throws java.io.IOException
Generates the set clause.

Overrides:
generateSetKey in class Id
Throws:
java.io.IOException

generateCastFromObject

public java.lang.String generateCastFromObject(java.lang.String value)
Generates code to convert to the type from the object.

Overrides:
generateCastFromObject in class Id

generateMatch

public void generateMatch(JavaWriter out,
                          java.lang.String key)
                   throws java.io.IOException
Generates code for a match.

Overrides:
generateMatch in class Id
Throws:
java.io.IOException

generateEquals

public java.lang.String generateEquals(java.lang.String leftBase,
                                       java.lang.String value)
Generates code to test the equals.

Overrides:
generateEquals in class Id

generateCheckCreateKey

public void generateCheckCreateKey(JavaWriter out)
                            throws java.io.IOException
Generates the set clause.

Overrides:
generateCheckCreateKey in class Id
Throws:
java.io.IOException

toObject

public java.lang.String toObject(java.lang.String value)
Generates code to convert to the object.

Overrides:
toObject in class Id