Requirement # Save both Master and Detail data in a single transaction without throwing any error.
Solution : Open Entity association.xml ->Relationships->Behavior->Check 'Composition association' option
Requirement # All the child related data should get deleted from database upon deleting the parent record from database table
Solution:Open Entity association.xml ->Relationships->Behavior->Check 'Composition association' option, check ' Implement Cascade Delete'
This blog explains about learning/findings/experiences & Interesting features of Oracle Application Development Framework(ADF) , part of Oracle Fusion Middleware Technologies.
Thursday, April 12, 2012
Usage of overriding postChanges() in EntityImpl class.
push the middle-tier changes to the database without actually committing.
Scenario # You have a Master and detail tables and there is no foregin key relation ship, You may have to get the Master Primary key and set to child Entity, DBTransaction.commit() should first save the master record into Database then upon successful saving master recrod it should save the child recrod. So that dbTransaction.commit() shound't throw any 'Key Not found' related exceptions while saving both master and detail data in a single trascation.
Solution : postChange() override this method in EntityImpl class, what this will do is Push the middle-tier database related changes to database without actually performing commit, so that when child record gets inserted into database without any errors.
Refer below for more information http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/EntityImpl.html#postChanges_oracle_jbo_server_TransactionEvent_ Override below two methods in both master and child EOImpl classes
MasterEOImpl.java
public void postChanges(TransactionEvent TransactionEvent) {
if (getPostState() == STATUS_NEW) {
mNewServiceProviderCostsBeforePost = (RowSet) getServiceProviderCostEO();
}
super.postChanges(TransactionEvent);
}
ChildEOImpl.java
public void postChanges(TransactionEvent e)
{
if (getPostState() == STATUS_NEW getPostState() == STATUS_MODIFIED) {
MasterEOImpl masterEO= getMasterEO();
if (masterEO!= null) {
if (masterEO.getPostState() == STATUS_NEW) {
masterEO.postChanges(e);
}
}
}
super.postChanges(e);
}
and also override below methods in MasterEOImpl.java
refreshFKInNewContainees() - Iterate the child RowSet and set the primary key then close the rowSetIterator.
handlePostChangesError() - Override this method , If any error happens this will get invoked and close row set iterator.
Scenario # You have a Master and detail tables and there is no foregin key relation ship, You may have to get the Master Primary key and set to child Entity, DBTransaction.commit() should first save the master record into Database then upon successful saving master recrod it should save the child recrod. So that dbTransaction.commit() shound't throw any 'Key Not found' related exceptions while saving both master and detail data in a single trascation.
Solution : postChange() override this method in EntityImpl class, what this will do is Push the middle-tier database related changes to database without actually performing commit, so that when child record gets inserted into database without any errors.
Refer below for more information http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/EntityImpl.html#postChanges_oracle_jbo_server_TransactionEvent_ Override below two methods in both master and child EOImpl classes
MasterEOImpl.java
public void postChanges(TransactionEvent TransactionEvent) {
if (getPostState() == STATUS_NEW) {
mNewServiceProviderCostsBeforePost = (RowSet) getServiceProviderCostEO();
}
super.postChanges(TransactionEvent);
}
ChildEOImpl.java
public void postChanges(TransactionEvent e)
{
if (getPostState() == STATUS_NEW getPostState() == STATUS_MODIFIED) {
MasterEOImpl masterEO= getMasterEO();
if (masterEO!= null) {
if (masterEO.getPostState() == STATUS_NEW) {
masterEO.postChanges(e);
}
}
}
super.postChanges(e);
}
and also override below methods in MasterEOImpl.java
refreshFKInNewContainees() - Iterate the child RowSet and set the primary key then close the rowSetIterator.
handlePostChangesError() - Override this method , If any error happens this will get invoked and close row set iterator.
Monday, April 9, 2012
How to Configure AM Pool size
By default AM pool size is '25', So all the AM instances can be shared across multiple sessions, If you want to see how an UI application behaves in Prod base environments when number of users logged more than expected, You can make the AM pool size to as minimum as and access the applications in multiple browsers, and AM instances can be shared across multiple sessions and you will see how application performs.
Right click on UI Project ->Project Properties-> Run/Debug/Profile->Select Default and click on Edit -> Enter the below -D command and click on ok
-Djbo.ampool.minavailablesize=1 -Djbo.recyclethreshold=1 -Djbo.failover=true
Right click on UI Project ->Project Properties-> Run/Debug/Profile->Select Default and click on Edit -> Enter the below -D command and click on ok
-Djbo.ampool.minavailablesize=1 -Djbo.recyclethreshold=1 -Djbo.failover=true
Subscribe to:
Posts (Atom)