View Object New Attribute Setting Expression
I am trying to create a new attribute in a View Object. I wish to have the attribute contain some strings and fields (like dashes between other fields).
Simple concatenation works fine:
YEAR||SEQ||TYPE -- this works!
When I try to add the dash using the wizard like this:
YEAR||'-'||SEQ
I get an error in the SQL query and the following appears in the view.xml file:
YEAR||#39;-#39;||SEQ -- left out & so the #39 would post
I am considering creating an new table in Oracle, but this would be easier if it is possible.
I am using JDeveloper 9.0.3 and Oracle 9iAS on Windows 2000.
I have tried several ways to get the dash in the new attribute like "-", but the wizard will not cooperate and editing the file directly didn't work either.
Any ideas would be appreciated.
Hi Timo,
Thank you very much for the explanation and direction. I will do that way. I have found that implementing view object and view row class I could do the similar kind of thing for the transient attribute.
public Number getTotalPoints() {
RowIterator con= getConnectionViewImpl();
Number sum = new Number(0);
while (con.hasNext()) {
sum = sum.add( (Number)con.next().getAttribute("Points"));
} return sum;
} took form
http://technology.amis.nl/blog/1295/creating-a-dynamic-ajax-column-footer-summary-in-a-table-component-using-adf-faces
But it also slow as 1 st method
I am wonder whether both ways behave as similarly or they are totally different implementation?
Similar Messages
-
Hi all,
I have three table:
Member : MemberID(pk), Email, Adress, ProvinceID (fk)
Province : ProvinceID(pk), ProvinceName, CountryID(fk)
Country : CountryID(pk), CountryName.
After created three entities and object view for all of them.
In ProvinceView : i add a parameter for CountryID using Bind Variables + View Criteria to select Province from Country
In MemberView : i add more two entity: Province and Country then Add more attributes: CountryID (from Province table), CountryName(from Country table).
Create LOVs for CountryID and ProvinceID....that's i want: selected Country ----> Province auto show but when i selected Country, an error show like this :
(oracle.jbo.ReadOnlyAttrException) JBO-27008: Attribute Countryid in view object PhaiMemberacbView1 cannot be set.
What's solutions to fix this. ThanksHi,
Please verify if the Attribute Countryid has been marked as "Updatable" in the view object.
Best Regards,
Ankit Gupta -
View Object Transient attribute, refresh problem.
I have a VO which contains 3 entities joined. I added it a transient attribute with Groovy expression. My expression is : ReplyView.count("ReplyId"); , it counts two VO relationship. it counts normally but, when i insert a new reply, it doesnt refresh/update/recalculate the value. Whats the problem?
The dependency values referred to are accessed when you edit the transient attribute in the view object. On the left hand panel select dependencies and shuttle the columns that the transient is dependent on. I don't think this matters for non-entity based views since the SQL is fixed but for entity based views this assures the dependent columns are added to the query even if they are not needed by the page.
http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcentities.htm#ADFFD20177 -
View Object transient attribute (Calculate sum) using groovy problem
Hi
I have a read only view object named "ConnectionVVO". And it has database field name "points"(type is number).
Now I need to take the sum of points.
For this I did the following.
Self view object added to the same view object as a view accessor named "ConnectionVVO1".
Created a transient attribute named "TotalPoints".
Added following groovy as the value expression of the above transient attribute.
adf.object.ConnectionVVO1.getRowSet().sum("points")after that when I run the application module and run the view object it was extremely slow. Actually nothing was appeared. There after I modified the sql statement and added a where clouse to select few rows.
Then it was appeared without slowness.
The table has around 11 million records.
Could you please provide a hint or any alternate way for doing this(getting the sum of points).
Please help.
Edited by: deshan on Mar 9, 2011 2:56 PMHi Timo,
Thank you very much for the explanation and direction. I will do that way. I have found that implementing view object and view row class I could do the similar kind of thing for the transient attribute.
public Number getTotalPoints() {
RowIterator con= getConnectionViewImpl();
Number sum = new Number(0);
while (con.hasNext()) {
sum = sum.add( (Number)con.next().getAttribute("Points"));
} return sum;
} took form
http://technology.amis.nl/blog/1295/creating-a-dynamic-ajax-column-footer-summary-in-a-table-component-using-adf-faces
But it also slow as 1 st method
I am wonder whether both ways behave as similarly or they are totally different implementation? -
Getting a View Object Total Attributes
Hi, Is there any way to retrieve the Attribute count (DataBase Columns) of a View Object in its own java implementation?
I'm using this:
JDev 11.1.1.6
System.out.println("this.getEntityDef(0).getAttributeCount() " + this.getEntityDef(0).getAttributeCount());
System.out.println("Column count1 " + this.getAttributeCount());
System.out.println("Column count2 " + this.getAttributeDefs().length);
System.out.println("Column count3 " + this.getProperties().size());
but none of them works the best way:
the first one gives me 6 more than the actual columns that excist in the entity object
the second and third are gives me more than the attributes of that object
the forth gives me 200 and more
which way gives me the count of the database table columns, and how can I access it in by index?
thanks- Here is modified code, which prints attribute name along with database column name the attribute represents:
public int getCountOfPersistentAttrs() {
int result = 0;
for (AttributeDef attr : getAttributeDefs()) {
if (attr.getAttributeKind() == AttributeDef.ATTR_PERSISTENT) {
System.out.println("Name of persistent attribute : " + attr.getName());
System.out.println("Name of the database column the attribute represents : " + attr.getColumnName());
result++;
return result;
} -
How to apply validation rule for View Object (VO) attributes?
How to add Validation Rules to VO attributes, just like EO Business Rules?
I got 2 problem with that:
1. VO can join multiple tables, and the attribute's validation rules may reference to the fields from multiple entities.
2. Since the EO Validation Rules only execute before the data actually write to entity (Commit operation). But user may need to input data from multiple pages with only 1 commit.
I am using JDeveloper 11g with ADF BC.
Regards,
Samson FuJust something to point out, the EO validation doesn't fire on a commit (if you mean commit as in the database/AppModule commit). You can also access VO information from the EO validation rules by using view accessors.
Regards
Grant -
View Object transient attributes with SQL default value
Dear All
I am working on JDeveloper 12.1.2
In my scenario i have application module A in my main application. I created another data model with Application module B. I imported AM B into my main project.
The problem is that when i have a transient attribute based on SQL statment in AM B, it gives me error in runtime on the interface but when i run the application module it works fine ... i do not know why
RegardsHi,
what sqlstatement you worte? what error?
thanks -
Null Pointer Exception after adding Transient attribute in View Object
Hello Experts
I am using Jdev 11.1.2.3. I have added a transient attribute in view object and set default value to another view object attribute via view accessor of view link between view objects. the value of expression is ItemMasterRO.Description, where ItemMasterRO is the name of view accessor define in the view link and Description is the name of attribute which is in other view object.
Data is retrieving as per my requirements, but when i click on add record button in application module, it is throwing a null pointer exception. Here is stack trace
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NullPointerException, msg=null
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1218)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1253)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1075)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2132)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1856)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1967)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:829)
at oracle.jbo.server.ViewRowImpl.getAttrInvokeAccessor(ViewRowImpl.java:911)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:859)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1213)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:764)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:792)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.updateValuesFromRow(JUCtrlAttrsBinding.java:145)
at oracle.jbo.uicli.jui.JULabelBinding.updateValuesFromRow(JULabelBinding.java:114)
at oracle.jbo.uicli.binding.JUIteratorBinding.updateValuesFromRows(JUIteratorBinding.java:349)
at oracle.adf.model.binding.DCIteratorBinding.setupRSIstate(DCIteratorBinding.java:867)
at oracle.adf.model.binding.DCIteratorBinding.refreshControlAndNotifyDCE(DCIteratorBinding.java:707)
at oracle.adf.model.binding.DCIteratorBinding.refreshControl(DCIteratorBinding.java:676)
at oracle.jbo.uicli.binding.JUIteratorBinding.refreshControl(JUIteratorBinding.java:485)
at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4555)
at oracle.adf.model.binding.DCBindingContainer.refreshExecutables(DCBindingContainer.java:3542)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3375)
at oracle.adf.model.binding.DCBindingContainer.refreshControl(DCBindingContainer.java:2938)
at oracle.jbo.jbotester.NavigationBar.doInsertAction(NavigationBar.java:143)
at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:110)
at oracle.jbo.uicli.controls.JUNavigationBar$NavButton.actionPerformed(JUNavigationBar.java:118)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.acceptGetProperty(PogoGetPropertySite.java:32)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:237)
at bc4j_com_syncreon_model_queries_SequenceItemContainerXrefVO_ItemDescription_null_gs.run(bc4j_com_syncreon_model_queries_SequenceItemContainerXrefVO_ItemDescription_null_gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1200)
... 62 more
## Detail 0 ##
java.lang.NullPointerException
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.acceptGetProperty(PogoGetPropertySite.java:32)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:237)
at bc4j_com_syncreon_model_queries_SequenceItemContainerXrefVO_ItemDescription_null_gs.run(bc4j_com_syncreon_model_queries_SequenceItemContainerXrefVO_ItemDescription_null_gs.groovy:1)
at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1200)
at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1253)
at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1075)
at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2132)
at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1856)
at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1967)
at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:829)
at oracle.jbo.server.ViewRowImpl.getAttrInvokeAccessor(ViewRowImpl.java:911)
at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:859)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1213)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:764)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:792)
at oracle.jbo.uicli.binding.JUCtrlAttrsBinding.updateValuesFromRow(JUCtrlAttrsBinding.java:145)
at oracle.jbo.uicli.jui.JULabelBinding.updateValuesFromRow(JULabelBinding.java:114)
at oracle.jbo.uicli.binding.JUIteratorBinding.updateValuesFromRows(JUIteratorBinding.java:349)
at oracle.adf.model.binding.DCIteratorBinding.setupRSIstate(DCIteratorBinding.java:867)
at oracle.adf.model.binding.DCIteratorBinding.refreshControlAndNotifyDCE(DCIteratorBinding.java:707)
at oracle.adf.model.binding.DCIteratorBinding.refreshControl(DCIteratorBinding.java:676)
at oracle.jbo.uicli.binding.JUIteratorBinding.refreshControl(JUIteratorBinding.java:485)
at oracle.adf.model.binding.DCIteratorBinding.refresh(DCIteratorBinding.java:4555)
at oracle.adf.model.binding.DCBindingContainer.refreshExecutables(DCBindingContainer.java:3542)
at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3375)
at oracle.adf.model.binding.DCBindingContainer.refreshControl(DCBindingContainer.java:2938)
at oracle.jbo.jbotester.NavigationBar.doInsertAction(NavigationBar.java:143)
at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:110)
at oracle.jbo.uicli.controls.JUNavigationBar$NavButton.actionPerformed(JUNavigationBar.java:118)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Please advice....
ThanksHi,
Just the exception stack without any information like what JDev version, what expression you've used for the default value of the transient attribute etc., is not enough for us to help you.
-Arun -
JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time
Hi,
I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
public void populateOSTable(int P_EmpId)
String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
String m_OrderBy = "EmpView.EMP_NAME";
oracle.jbo.ApplicationModule appModule = null;
ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
vo.setWhereClause(m_whereString);
vo.setOrderByClause(m_OrderBy);
vo.executeQuery();
vo.next();
String empName numAttrs = vo.getAttribute(EmpName);
System.out.println(empName);
Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
Here is how I have usually done mine:
1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
2. Use a custom web bean to process the results of the query (print to HTML).
for example:
<jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
<%
// get the parameter from the find form
String p = request.getParameter("p");
String s = request.getParameter("s");
// store the information for reference later
session.putValue("p", p);
session.putValue("s", s);
// initialize the app module and view object
rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
// set the where clause string
String theclause = "presname = '" + p + "' AND slideno=" + s;
// set the where clause for the VO
rsn.getRowSet().getViewObject().setWhereClause(theclause);
rsn.getRowSet().getViewObject().executeQuery();
rsn.getRowSet().first();
%>
</jsp:useBean>
<jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
<%
// initialize the app module and VO
wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
wtb.render();
%>
In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
Hope this helps.
</jsp:useBean><HR></BLOCKQUOTE>
Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
Nathalie
null -
How to Use Transient View Objects to Store Session-level Global Variables
hi
Please consider section "40.8.5 How to Use Transient View Objects to Store Session-level Global Variables"
at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/bcstatemgmt.htm#ADFFD19610
Based on this documentation I created the example application
at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.01.zip
It behaves as show in the screencast at http://screencast.com/t/qDvSQCgpvYdd
Its Application Module has a Transient View Object instance "MyEmployeesContextVOVI", as master for the child View Object instance "EmpInCtxJobVI".
On rollback the Transient View Object instance keeps its row and attribute values.
Also when passivation and activation is forced (using jbo.ampool.doampooling=false ) the Transient View Object instance seems to keep its row and attribute values.
questions:
- (q1) Why does the expression #{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty} evaluate as true when a Transient View Object instance attribute value is changed (as shown in screencast at http://screencast.com/t/qDvSQCgpvYdd )?
- (q2) What would be a robust approach to make a Transient View Object instance more self-contained, and manage itself to have only one single row (per instance) at all times (and as such removing the dependency on the Application Module prepareSession() as documented in "5. Create an empty row in the view object when a new user begins using the application module.")?
many thanks
Jan VerveckenThanks for your reply Frank.
q1) Does sample 90 help ? http://blogs.oracle.com/smuenchadf/examples/
Yes, the sample from Steve Muench does help, "90. Avoiding Dirtying the ADF Model Transaction When Transient Attributes are Set [10.1.3] "
at http://blogs.oracle.com/smuenchadf/examples/#90
It does point out a difference in marking transactions dirty by different layers of the framework, "... When any attribute's value is changed through an ADFM binding, the ADFM-layer transaction is marked as dirty. ...".
This can be illustrate with a small change in the example application
at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.02.zip
It now shows the result of both these expressions on the page ...
#{bindings.MyEmployeesContextVOVIIterator.dataControl.transactionDirty}
#{bindings.MyEmployeesContextVOVIIterator.dataControl.dataProvider.transaction.dirty}... where one can be true and the other false respectively.
See also the screencast at http://screencast.com/t/k8vgNqdKgD
Similar to the sample from Steve Muench, another modification to the example application introduces MyCustomADFBCDataControl
at http://www.consideringred.com/files/oracle/2010/ProgrammaticalViewObjectAndRollbackApp-v0.03.zip
public class MyCustomADFBCDataControl
extends JUApplication
@Override
public void setTransactionModified()
ApplicationModule vApplicationModule = (ApplicationModule)getDataProvider();
Transaction vTransaction = vApplicationModule.getTransaction();
if (vTransaction.isDirty())
super.setTransactionModified();
}Resulting in what seems to be more consistent/expected transaction (dirty) information,
see also the screencast at http://screencast.com/t/756yCs1L1
Any feedback on why the ADF Model layer is so eager to mark a transaction dirty is always welcome.
Currently, question (q2) remains.
regards
Jan -
How to bind dynamic columns in ADF table to view object
In the below piece of code i am trying to bind a dynamically added column to my newly added attribute in view object, but the value expression does not set the value of this attibute in the view object please help on what is wrong in this code ??
<af:table value="#{bindings.ViewObj1.collectionModel}" var="row"
rows="#{bindings.ViewObj1.rangeSize}"
emptyText="#{bindings.ViewObj1.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.ViewObj1.rangeSize}"
filterModel="#{bindings.ViewObj1Query.queryDescriptor}"
queryListener="#{bindings.ViewObj1Query.processQuery}" varStatus="vs"
selectedRowKeys="#{bindings.ViewObj1.collectionModel.selectedRow}"
rowSelection="single"
binding="#{backingBeanScope.backing_createDTpg1.table1}"
id="table1"
columnSelection="single"
partialTriggers="::addCol ::addColAfter ::addColBefore ::removeCol ::addRow ::addRowAfter ::addRowBefore ::removeRow ::addAction ::addActionAfter ::addActionBefore ::deleteAction :::dialog1 :::d1"
allDetailsEnabled="true" verticalGridVisible="false"
horizontalGridVisible="true" width="100%" disableColumnReordering="true"
selectionListener="#{bindings.ViewObj1.collectionModel.makeCurrent}"
immediate="true" contentDelivery="immediate"
editingMode="clickToEdit" autoHeightRows="-1">
<af:column sortProperty="Sno" filterable="false" sortable="false"
headerText="Sno"
align="center" width="28" rowHeader="true"
inlineStyle="font-style:italic;" frozen="true"
id="sno" selected="true" headerNoWrap="true"
displayIndex="0">
<af:outputText id="ot0" value="#{vs.index+1}"/>
</af:column>
<af:column id="separatorColumn" align="center"
width="15" frozen="true" displayIndex="1"
rowHeader="unstyled" sortable="false"
filterable="false" selected="false"
inlineStyle='background-image:url("jheadstart/images/jsp_forward.png"); background-repeat:no-repeat; outline-color:InactiveCaption; outline-style:solid; outline-width:thin;'
headerText=""/>
</af:table>
DCBindingContainer dcBindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind =
(DCIteratorBinding)dcBindings.get("ViewObj1Iterator");
ViewObject decisionTableView1 = iterBind.getViewObject();
System.out.println("before getAttributeCount :"+decisionTableView1.getAttributeCount());
int counter = decisionTableView1.getAttributeCount() + 1;
AttributeDef attribute =
decisionTableView1.addDynamicAttribute("condition_" + counter);
RichColumn column = new RichColumn();
column.setId("condition_" + counter);
column.setHeaderText("condition_" + counter);
column.setNoWrap(true);
RichInputText inputtext = new RichInputText();
inputtext.setId("condition_"+counter);
inputtext.setAutoSubmit(true);
inputtext.setValueExpression("condition_"+counter,
getValueBinding("#{row.bindings.condition_" +
counter +
".inputValue}"));
column.getChildren().add(inputtext);
RichCommandImageLink headerLink = new RichCommandImageLink();
headerLink.setText("<<Select Fact>>");
headerLink.setId("conditionLink_" + counter);
column.setHeader(headerLink);
List columnList = this.table1.getChildren();
int separatorColumnIndex =
findColumnIndex(columnList, "separatorColumn");
if (columnIndex == -1 || columnIndex > separatorColumnIndex) {
columnIndex = separatorColumnIndex;
System.out.println("Column Index :" + columnIndex);
column.setDisplayIndex(columnIndex);
this.table1.getChildren().add(columnIndex, column);Sorry Frank i could not figure out what u rtrying to say.
In my case i have ADF table with two predefined coulmns :
1 : a serial number read only column
2 : a separator coumn
I need help to bind the newly created dynamic attribute in the VO with my newly created column in the ADF table which has a input text as child.
My problem is binding the is not working properly as values entered in the Table are not reflected in the VO.
And when i insert a new column in between two columns which has already filled values the data in the rows does not shift coreespondingly..
Edited by: user10281080 on Jul 27, 2009 12:22 AM -
Bug in JDev 9.0.3.3: Adding new attributes
for me, it's seems to be a bug when:
- you have an existing view object with attributes of two EOs
- add new attributes from the EOs to the view object (in our case the column names are identical, JDev names them to TCN and TCN1 in the select-statement of the query)
- update of the query of the view object doesn't properly work as well as attribute mapping shows that my new attributes are transient
- removing all attributes from the view object and reassigning them again leads to a strange attribute mapping, i.e. now I have to set them again by manual.
Does anyone have the same experience with attribute removal and addtion of view objects?
Regards,
StefanStefan,
I tried to reproduce it with my 9.0.3.3 (Build 1205) installation but wasn't successful. Here's what I did:
1. Create 2 entities
2. Create one VO based on the two
3. Run it
4. Edit the VO and add an attribute from the second entity having the same name
5. Run it
There must be something that you do differently from what I describe. Can you try to find ou what it is?
Frank -
Problem occured when create a tree table for master-detail view objects using SQL queries?
I am programming a tree table for master-detail view objects using SQL queries and these 2 view objects are not simple singel tables queries, and 2 complex SQL are prepared for master and view objects. see below:
1. Master View object (key attribute is SourceBlock and some varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK
2. Detail View object (key attributes are SourceBlock and EndBlock and same varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
yb2.BLOCK_M as END_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, yb2.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK
3. I create a view link to create master-detail relationship for these 2 view objects.
masterview.SourceBlock (1)->detailview.SourceBlock (*).
4. I create a tree table using these 2 view objects with master-detail relationship.
When I set default value for variable bindings of these 2 view objects and the matching records exist, tree table can work well. I can expand the master row to display detail row in UI.
But I need to pass in dymamic parameter value for variable bindings of these 2 view objects, tree table cannnot work again. when I expand the master row and no detail row are displayed in UI.
I am sure that I pass in correct parameter value for master/detail view objects and matching records exist.
Managed Bean:
DCIteratorBinding dc = (DCIteratorBinding)evaluteEL("#{bindings.MasterView1Iterator}");
ViewObject vo = dc.getViewObject();
System.out.println("Before MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
System.out.println("Before MasterView1Iterator ShiftModeCode="+ vo.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
System.out.println("MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
DCIteratorBinding dc1 = (DCIteratorBinding)evaluteEL("#{bindings.DetailView1Iterator}");
ViewObject vo1 = dc1.getViewObject();
System.out.println("Before DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
System.out.println("Before DetailView1Iterator ShiftModeCode="+ vo1.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo1.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo1.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo1.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo1.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo1.executeQuery();
System.out.println("after DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
5. What's wrong in my implementation? I don't have no problem to implement such a tree table if using simple master-detail tables view object, but now I have to use such 2 view objects using complex SQL for my requirement and variable bindings are necessary for detail view object although I also think a bit strange by myself.Hi Frank,
Thank you and it can work.
public void setLowHighSalaryRangeForDetailEmployeesAccessorViewObject(Number lowSalary,
Number highSalary) {
Row r = getCurrentRow();
if (r != null) {
RowSet rs = (RowSet)r.getAttribute("EmpView");
if (rs != null) {
ViewObject accessorVO = rs.getViewObject();
accessorVO.setNamedWhereClauseParam("LowSalary", lowSalary);
accessorVO.setNamedWhereClauseParam("HighSalary", highSalary);
executeQuery();
but I have a quesiton in this way. in code snippet, it is first getting current row of current master VO to determine if update variables value of detail VO. in my case, current row is possibly null after executeQuery() of master VO and I have to change current row manually like below.
any idea?
DCIteratorBinding dc = (DCIteratorBinding)ADFUtil.evaluateEL("#{bindings.SSForecastSourceBlockView1Iterator}");
ViewObject vo = dc.getViewObject();
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
vo.setCurrentRowAtRangeIndex(0);
((SSForecastSourceBlockViewImpl)vo).synchornizeAccessorVOVariableValues(); -
DOC BUG: 9.0.3.1 View Object Wizard and a Question
First the question: What is the Passivate property for in the View Object Wizard's Attribute Settings page?
Related Doc Bugs 9.0.3.1
Topic: Define New View Attribute Dialog
(click Help button in New Attribute dialog when creating a view object attribute)
Problems: The description for the "Attribute" property is "foo"; Descrimator, Updateable, and Queriable have single letter descriptions. Key Attribute and Passivate are not listed.
Topic: View Object Wizard - Attribute Settings Page
(click Help button in Attribute Settings page in View Object Wizard)
Problems: Query Column Type and Passivate are not listed. Attribute Settings column lists properties in a strange order (not a bug).
Peter KoletzkePeter,
I've logged doc bug 2814172: BC4J GLOSSARY SHOULD HAVE ENTRIES FOR PASSIVATE AND ACTIVATE.
For more information, you could read the "About Application Module Pooling" topic in the online documentation. Passivation is what happens when the application module's state is saved to the database - and activation happens when an application module instance retrieves passivated state from the database.
Thanks
Blaise -
How to retrieve the values from a Transient View Object
Hi Experts,
I am using Jdevelpoer11.1.1.5.0. I created one Transient view object with attributes EmpId,Salary.
In Backing Bean i will create rows for that view object and display it in the form of <af:Table> like Empid, Salary and an Update Link.
Now my problem is i want to update the salary of the particular EmpId. For Example if the EmpId is 100 and salary is 10000 now i want to increase the salary to 20000 and if i click on the update button; i want to retrieve the particular employee details in my backing bean. How can i acheive this?
Thanks in advance.A better approach would be to programmatically populate rows in the <VO>Impl.java by overriding the executeQueryForCollection(0 as specified here -
http://adfpractice-fedor.blogspot.in/2011/01/adf-bc-programmatically-populated-vo.html
You can write the logic to update the salary in an AM method then on click of Update or in the getter of Salry field if logic is valid for all fields...
Maybe you are looking for
-
IDOC staus: 51, The difference is too large for clearing
All, IDOC staus: 51, the difference is too large for clearing. Can somebody throw light on this ? -Rajani Sateesh
-
N96 freezes/stuck when starting up and screen prob...
Hi, I am new and i would like to know why my N96 stucks at a blank white screen when starting up, is this what they call the "White screen of death"? I currently uses firmware version 12.043. Sometimes when I remove my microSD card and then turn on
-
PowerBook G4 shuts down without warning even when battery is over 60%
My powerbook has started to shut down without any warning - even if the battery is over 60% charged. The battery is the second (being sent free by apple under the replacement programme). I cannot restart until I have inserted the power cable. I have
-
Account 1000 in Co Cd. 4001 can't be directly posted to
Dear Friends, Please solve this error. "Account 1000 in Co Cd. 4001 can't be directly posted to" Thankyou Karun
-
Hi, I have not worked on either DRM or EPMA. The requirement is, we need to have a single point to manage metadata for our different Hyperion cubes. We are thinking of implementing EPMA but not successful with deploying ASO applications using EPMA. H