|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.StatementClassMapping
public class StatementClassMapping
Definition of statement mapping for a particular class. Provides a definition of how the results of a datastore query are mapped on to the fields of a class. If we take the example of this being the candidate class retrieved, then the memberName will be null and any children represent persistent objects also retrieved in this statement. So we process all fields in the result-set for this class, then instantiate any child object (with its id field(s)), and process all of its fields, etc.
We can have a result set with fields for multiple objects and instantiate more than 1 related object. To give an example of what an object of this type can look like
StatementClassMapping:class=null,member=null,mappings=
[
{field=0,mapping=mapping: org.datanucleus.store.mapped.mapping.IntegerMapping@5995c31c column(s): [2]},
{field=1,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@5947d51d column(s): [3]},
{field=2,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@585e7d87 column(s): [7]},
{field=-2,mapping=mapping: org.datanucleus.store.mapped.mapping.VersionLongMapping@ce796 column(s): [11]},
],
children=
[
{field=1,mapping=StatementClassMapping:class=org.datanucleus.test.CircRef,member=next,mappings=
[
{field=0,mapping=mapping: org.datanucleus.store.mapped.mapping.IntegerMapping@5995c31c column(s): [3]},
{field=1,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@5947d51d column(s): [4]},
{field=2,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@585e7d87 column(s): [5]},
{field=-2,mapping=mapping: org.datanucleus.store.mapped.mapping.VersionLongMapping@ce796 column(s): [6]}
]},
{field=2,mapping=StatementClassMapping:class=org.datanucleus.test.CircRef,member=prev,mappings=
[
{field=0,mapping=mapping: org.datanucleus.store.mapped.mapping.IntegerMapping@5995c31c column(s): [7]},
{field=1,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@5947d51d column(s): [8]},
{field=2,mapping=mapping: org.datanucleus.store.mapped.mapping.PersistableMapping@585e7d87 column(s): [9]},
{field=-2,mapping=mapping: org.datanucleus.store.mapped.mapping.VersionLongMapping@ce796 column(s): [10]}
]}
]
In this example we have a persistable object as candidate, and it has 2 1-1 relations (field=1, field=2).
These are both being retrieved in the same query, hence the sub-mappings. Note that the column(s) of the FK
in the owner object is the same as the PK field(s) of the related object.
| Field Summary | |
|---|---|
static int |
MEMBER_DATASTORE_ID
|
static int |
MEMBER_DISCRIMINATOR
|
static int |
MEMBER_VERSION
|
| Constructor Summary | |
|---|---|
StatementClassMapping()
|
|
StatementClassMapping(String memberName)
|
|
StatementClassMapping(String className,
String memberName)
|
|
| Method Summary | |
|---|---|
void |
addMappingDefinitionForMember(int position,
StatementClassMapping defn)
|
void |
addMappingForMember(int position,
StatementMappingIndex mapping)
|
StatementClassMapping |
cloneStatementMappingWithoutChildren()
|
String |
getClassName()
|
StatementClassMapping |
getMappingDefinitionForMemberPosition(int position)
Accessor for the mapping definition for the object at the specified member position. |
StatementMappingIndex |
getMappingForMemberPosition(int position)
Accessor for the mapping information for the member at the specified position. |
String |
getMemberName()
|
int[] |
getMemberNumbers()
Accessor for the numbers of the members present. |
String |
getNucleusTypeColumnName()
|
boolean |
hasChildMappingDefinitions()
Accessor for whether this definition has child object definitions. |
void |
setNucleusTypeColumnName(String colName)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MEMBER_DATASTORE_ID
public static final int MEMBER_VERSION
public static final int MEMBER_DISCRIMINATOR
| Constructor Detail |
|---|
public StatementClassMapping()
public StatementClassMapping(String className,
String memberName)
public StatementClassMapping(String memberName)
| Method Detail |
|---|
public String getClassName()
public String getMemberName()
public void setNucleusTypeColumnName(String colName)
public String getNucleusTypeColumnName()
public StatementMappingIndex getMappingForMemberPosition(int position)
position - The member position
public StatementClassMapping getMappingDefinitionForMemberPosition(int position)
position - The position of the member in this class
public boolean hasChildMappingDefinitions()
public int[] getMemberNumbers()
public void addMappingForMember(int position,
StatementMappingIndex mapping)
public void addMappingDefinitionForMember(int position,
StatementClassMapping defn)
public StatementClassMapping cloneStatementMappingWithoutChildren()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||