Professional Documents
Culture Documents
EntityImpl
The entity class
Represents a row
Provides getter and
setter methods
EntityDefImpl
The entity definition class
Represents the whole entity
Can be used to modify the entity definition
EntityCollImpl
Represents the cached set of rows from the entity
Not usually necessary to modify or override methods in this
class
PersonEOToOrderEO
OrderEO
PersonEO
getPersonEO()
getOrderEO() setPersonEO()
getEmail() getPersonEmail()
Accessor in source Accessors in destination
to get destination to get and set source
// In <Entity name>Impl.java
// In ProductEOImpl.java
import oracle.jbo.server.SequenceImpl;
// Default ProdId value from PRODUCTS_SEQ sequence at
1 protected void initDefaults() {
2 super.initDefaults();
SequenceImpl sequence = new
3 SequenceImpl("PRODUCTS_SEQ",getDBTransaction());
DBSequence dbseq = new
4
DBSequence(seq.getSequenceNumber());
5 populateAttributeAsChanged(ProdId, dbseq);
}
ViewObjectImpl
The view class
Provides methods
to manage the row
set
ViewDefImpl
The view definition class
Represents the whole view
Can be used to modify the view definition
ViewRowImpl
The view object row class
Instantiated for each record returned by the query
Provides attribute accessors
Created by default:
<AppMod>AM.xml: Includes detailed metadata about the
View Objects included
bc4j.xcfg: Contains all the configuration and connection
details
Supporting Java classes:
<AppMod>AMImpl.java: Contains all the methods and
behaviors that affect each application module instance
<AppMod>AMDef.java: Contains methods to be used by
all instances of the application module
X Code to
manipulate
view objects
Click Execute.
Observe results.
Post phase
Commit phase
Implement a TransactionListener.
Implement beforeCommit() and afterCommit().
Add your listener to the transactions list of
event subscribers.
Alternatively, override the entity objects
beforeCommit() or afterCommit() methods.
Example: In PersonEOImpl, print notification that record is committed:
@Override
public void afterCommit(TransactionEvent transactionEvent) {
System.out.println("Record committed for " +
getFirstName() + " " + getLastName());
super.afterCommit(transactionEvent);
}
2 EntityImpl newProduct =
productDef.createInstance2(getDBTransaction(),null);
newProduct.setAttribute("Name",name);
3 newProduct.setAttribute("Description",description);
try {
4 getDBTransaction().commit(); }
catch (JboException ex) {
throw ex; }
5 DBSequence newIdAssigned =
(DBSequence)newProduct.getAttribute("ProdId");
return newIdAssigned.getSequenceNumber().longValue();
[Ctrl]+[Enter]
ViewObject
setWhereClause
Row RowSet setNamedWhereClauseParam setNamedWhereClauseParam
Row executeQuery executeQuery
Row
hasNext hasNext hasNext
RowSetIterator
next next next
ViewCriteria vc = custOrdVO.createViewCriteria(); 1
vc.addElement(promotionRow); 4
vc.addElement(noPromRow);
5
custOrdVO.applyViewCriteria(vc);
6
custOrdVO.executeQuery();