use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.
the class NestedForeignKeyProject method getTeamDescriptor.
private EISDescriptor getTeamDescriptor() {
EISDescriptor descriptor = new EISDescriptor();
descriptor.setJavaClass(Team.class);
descriptor.setDataTypeName("team");
descriptor.setPrimaryKeyFieldName("@id");
EISDirectMapping idMapping = new EISDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
EISCompositeCollectionMapping employeesMapping = new EISCompositeCollectionMapping();
employeesMapping.setAttributeName("employees");
employeesMapping.useCollectionClass(java.util.Vector.class);
employeesMapping.setReferenceClass(Employee.class);
employeesMapping.setXPath("employee");
descriptor.addMapping(employeesMapping);
// Insert
XQueryInteraction insertCall = new XQueryInteraction();
insertCall.setFunctionName("insert");
insertCall.setProperty("fileName", "team.xml");
insertCall.setXQueryString("team");
descriptor.getQueryManager().setInsertCall(insertCall);
// Read object
XQueryInteraction readObjectCall = new XQueryInteraction();
readObjectCall.setFunctionName("read");
readObjectCall.setProperty("fileName", "team.xml");
readObjectCall.setXQueryString("team[@id='#@id']");
readObjectCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadObjectCall(readObjectCall);
// Read all
XQueryInteraction readAllCall = new XQueryInteraction();
readAllCall.setFunctionName("read-all");
readAllCall.setProperty("fileName", "team.xml");
readAllCall.setXQueryString("team");
readAllCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadAllCall(readAllCall);
// Delete
XQueryInteraction deleteCall = new XQueryInteraction();
deleteCall.setFunctionName("delete");
deleteCall.setProperty("fileName", "team.xml");
deleteCall.setXQueryString("team[@id='#@id']");
descriptor.getQueryManager().setDeleteCall(deleteCall);
// Update
XQueryInteraction updateCall = new XQueryInteraction();
updateCall.setFunctionName("update");
updateCall.setProperty("fileName", "team.xml");
updateCall.setXQueryString("team[@id='#@id']");
descriptor.getQueryManager().setUpdateCall(updateCall);
return descriptor;
}
use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.
the class NestedForeignKeyProject method getProjectDescriptor.
private ClassDescriptor getProjectDescriptor() {
EISDescriptor descriptor = new EISDescriptor();
descriptor.setJavaClass(Project.class);
descriptor.setDataTypeName("project");
descriptor.setPrimaryKeyFieldName("@id");
EISDirectMapping nameMapping = new EISDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setXPath("name/text()");
descriptor.addMapping(nameMapping);
EISDirectMapping idMapping = new EISDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
// Insert
XQueryInteraction insertCall = new XQueryInteraction();
insertCall.setXQueryString("project");
insertCall.setFunctionName("insert");
insertCall.setProperty("fileName", "project.xml");
descriptor.getQueryManager().setInsertCall(insertCall);
// Read object
XQueryInteraction readObjectCall = new XQueryInteraction();
readObjectCall.setFunctionName("read");
readObjectCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
readObjectCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadObjectCall(readObjectCall);
// Read all
XQueryInteraction readAllCall = new XQueryInteraction();
readAllCall.setFunctionName("read-all");
readAllCall.setProperty("fileName", "project.xml");
readAllCall.setXQueryString("project");
readAllCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadAllCall(readAllCall);
// Delete
XQueryInteraction deleteCall = new XQueryInteraction();
deleteCall.setFunctionName("delete");
readAllCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
descriptor.getQueryManager().setDeleteCall(deleteCall);
// Update
XQueryInteraction updateCall = new XQueryInteraction();
updateCall.setFunctionName("update");
readAllCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
descriptor.getQueryManager().setUpdateCall(updateCall);
return descriptor;
}
use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.
the class NestedOwnedToExternalRootProject method getProjectDescriptor.
private ClassDescriptor getProjectDescriptor() {
EISDescriptor descriptor = new EISDescriptor();
descriptor.setJavaClass(Project.class);
descriptor.setDataTypeName("project");
descriptor.setPrimaryKeyFieldName("@id");
EISDirectMapping nameMapping = new EISDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setXPath("name/text()");
descriptor.addMapping(nameMapping);
EISDirectMapping idMapping = new EISDirectMapping();
idMapping.setAttributeName("id");
idMapping.setXPath("@id");
descriptor.addMapping(idMapping);
// Insert
XQueryInteraction insertCall = new XQueryInteraction();
insertCall.setXQueryString("project");
insertCall.setFunctionName("insert");
insertCall.setProperty("fileName", "project.xml");
descriptor.getQueryManager().setInsertCall(insertCall);
// Read object
XQueryInteraction readObjectCall = new XQueryInteraction();
readObjectCall.setFunctionName("read");
readObjectCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
readObjectCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadObjectCall(readObjectCall);
// Read all
XQueryInteraction readAllCall = new XQueryInteraction();
readAllCall.setFunctionName("read-all");
readAllCall.setProperty("fileName", "project.xml");
readAllCall.setXQueryString("project");
readAllCall.setOutputResultPath("result");
descriptor.getQueryManager().setReadAllCall(readAllCall);
// Delete
XQueryInteraction deleteCall = new XQueryInteraction();
deleteCall.setFunctionName("delete");
readAllCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
descriptor.getQueryManager().setDeleteCall(deleteCall);
// Update
XQueryInteraction updateCall = new XQueryInteraction();
updateCall.setFunctionName("update");
readAllCall.setProperty("fileName", "project.xml");
readObjectCall.setXQueryString("project[@id='#@id']");
descriptor.getQueryManager().setUpdateCall(updateCall);
return descriptor;
}
use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.
the class NestedOwnedToExternalRootTestCases method createTables.
@Override
protected void createTables() {
// Drop tables
XQueryInteraction interaction = new XQueryInteraction();
XMLFileInteractionSpec spec = new XMLFileInteractionSpec();
interaction = new XQueryInteraction();
interaction.setFunctionName("drop-PROJECT");
spec = new XMLFileInteractionSpec();
spec.setFileName("project.xml");
spec.setInteractionType(XMLFileInteractionSpec.DELETE);
interaction.setInteractionSpec(spec);
session.executeNonSelectingCall(interaction);
interaction = new XQueryInteraction();
interaction.setFunctionName("drop-COMPANY");
spec = new XMLFileInteractionSpec();
spec.setFileName("company.xml");
spec.setInteractionType(XMLFileInteractionSpec.DELETE);
interaction.setInteractionSpec(spec);
session.executeNonSelectingCall(interaction);
}
use of org.eclipse.persistence.eis.interactions.XQueryInteraction in project eclipselink by eclipse-ee4j.
the class RootToRootTestCases method createTables.
@Override
protected void createTables() {
// Drop tables
XQueryInteraction interaction = new XQueryInteraction();
XMLFileInteractionSpec spec = new XMLFileInteractionSpec();
interaction = new XQueryInteraction();
interaction.setFunctionName("drop-PROJECT");
spec = new XMLFileInteractionSpec();
spec.setFileName("project.xml");
spec.setInteractionType(XMLFileInteractionSpec.DELETE);
interaction.setInteractionSpec(spec);
session.executeNonSelectingCall(interaction);
interaction = new XQueryInteraction();
interaction.setFunctionName("drop-EMPLOYEE");
spec = new XMLFileInteractionSpec();
spec.setFileName("employee.xml");
spec.setInteractionType(XMLFileInteractionSpec.DELETE);
interaction.setInteractionSpec(spec);
session.executeNonSelectingCall(interaction);
}
Aggregations