public class ObjectCopyingPolicy extends Object
Description: This is for usage with the object copying feature, not the unit of work. This is useful for copying an entire object graph as part of the host application's logic.
Responsibilities:
Session.copyObject(Object, ObjectCopyingPolicy)
Modifier and Type | Field and Description |
---|---|
static int |
CASCADE_ALL_PARTS
Depth level indicating that all relationships with mappings should be used when
building the copied object graph
|
static int |
CASCADE_PRIVATE_PARTS
Depth level indicating that only relationships with mapping indicated privately-
owned should be copied
|
protected IdentityHashtable |
copies |
protected int |
depth
Policy depth that determines how the copy will cascade to the object's
related parts
|
static int |
NO_CASCADE
Depth level indicating that NO relationships should be included in the copy.
|
protected AbstractSession |
session |
protected boolean |
shouldResetPrimaryKey |
Constructor and Description |
---|
ObjectCopyingPolicy()
PUBLIC:
Return a new copying policy.
|
Modifier and Type | Method and Description |
---|---|
void |
cascadeAllParts()
PUBLIC:
Set if the copy should cascade all relationships when copying the object(s).
|
void |
cascadePrivateParts()
PUBLIC:
Set if the copy should cascade only those relationships that are configured
as privately-owned.
|
void |
dontCascade()
PUBLIC:
Set if the copy should not cascade relationships when copying the object(s)
|
IdentityHashtable |
getCopies()
INTERNAL: Get the session.
|
int |
getDepth()
INTERNAL: Return the cascade depth.
|
AbstractSession |
getSession()
INTERNAL: Return the session.
|
void |
setCopies(IdentityHashtable newCopies)
INTERNAL: Set the copies.
|
void |
setDepth(int newDepth)
INTERNAL: Set the cascade depth.
|
void |
setSession(AbstractSession newSession)
INTERNAL: Set the session.
|
void |
setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey)
PUBLIC:
Set if the primary key should be reset to null.
|
boolean |
shouldCascade()
PUBLIC:
Return true if the policy has been configured to CASCADE_ALL_PARTS or CASCADE_PRIVATE_PARTS.
|
boolean |
shouldCascadeAllParts()
PUBLIC:
Return true if the policy should CASCADE_ALL_PARTS
|
boolean |
shouldCascadePrivateParts()
PUBLIC:
Return true if the policy should CASCADE_PRIVATE_PARTS
|
boolean |
shouldResetPrimaryKey()
PUBLIC:
Return if the primary key should be reset to null.
|
String |
toString()
INTERNAL:
|
protected boolean shouldResetPrimaryKey
protected AbstractSession session
protected IdentityHashtable copies
protected int depth
public static final int NO_CASCADE
public static final int CASCADE_PRIVATE_PARTS
public static final int CASCADE_ALL_PARTS
public ObjectCopyingPolicy()
public void cascadeAllParts()
public void cascadePrivateParts()
public void dontCascade()
public IdentityHashtable getCopies()
public int getDepth()
public AbstractSession getSession()
public void setCopies(IdentityHashtable newCopies)
public void setDepth(int newDepth)
public void setSession(AbstractSession newSession)
public void setShouldResetPrimaryKey(boolean newShouldResetPrimaryKey)
public boolean shouldCascade()
public boolean shouldCascadeAllParts()
public boolean shouldCascadePrivateParts()
public boolean shouldResetPrimaryKey()
Copyright © 2021. All rights reserved.