BC4J view objects on pipeline functions
Hello,
I just wanted to find out if we can place a BC4J view object on the new Oracle 9i Pipeline functions.
Thanks
Ramna
If it still looks on the outside like a database view to the JDBC client (BC4J in this case), then sure.
If you're making updates, then your underlying entity object will have to:
[list]
[*]Be mapped to an appropriate, updateable table, or
[*]Write INSTEAD OF triggers for your view
[list]
Let us know if you hit any problems.
Similar Messages
-
Interactive Report using a View with a Pipelined Function
Hello fellow Apex people,
I'm Using Application Express 4.1.0.00.32
I've got an interactive report that references a view (STOCK) and a pipelined function
The basic query is listed below.
SELECT S.CHANGED_TIME "Changed Time"
, S.CHANGED_BY "Changed By"
, S.ID "Id"
, STKST_DESCRS.STOCK_STATUS_CODES "Stock Status Codes"
, STKST_DESCRS.STOCK_STATUS_DESCRS "Stock Status"
, S.ORIGINAL_CONTAINER "Original Container"
FROM STOCK S
, table(LWS_StkstStatus (S.ID)) STKST_DESCRS
ORDER BY S.CO_ID,
S.SEQUENCE_NUM;
When the page is first run all the data is displayed correctly,
If I define a filter, sort or a blank search the data from the pipelined function (STKST_DESCRS.) becomes null and isn't displayed.
Does anyone know what is happening?
Many ThanksI'm curious why you find this dangerous. I want a report that looks like this:
Opportunity X:
4 - 2-apr-2008 - Closed deal
3 - 1-mar-2008 - Called Joe again
2 - 12-feb-2008 - Called Joe
1 - 14-jan-2008 - Initial call with customer.
When you enter a new note, I want it to be numbered 5. The only problem I can imagine is someone deleting a note, which will almost never happen, and if it does, it just leaves a numbering gap. I don't see how using the function in a SELECT will accomplish this. -
Hi!
I have a problem with List View Report in mobile application (theme 50 in apex) after updating to apex 4.2.2. I created Report -> List View. I used select from pipelined function in Region Source. Then when page is running and submited three times (or refreshed three times) I get an error:
Error during rendering of region "LIST VIEW".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 21230833903737364557
component.name: LIST VIEW
error_backtrace:
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
I get this error only when I use select from pipelined function in Region Source (for example: "select value1, value2 from table(some_pipelined_function(param1, param2)) ").
You can check it on http://apex.oracle.com/pls/apex/f?p=50591 (login - demo, password - demo).
In this application:
- I created package TAB_TYPES_PKG:
create or replace PACKAGE TAB_TYPES_PKG IS
TYPE cur_rest_r IS RECORD (
STR_NAME VARCHAR2(128),
INFO VARCHAR2(128)
TYPE cur_rest_t IS TABLE OF cur_rest_r;
END TAB_TYPES_PKG;
- I created pipelined function TEST_FUNC:
create or replace
FUNCTION TEST_FUNC
RETURN TAB_TYPES_PKG.cur_rest_t PIPELINED IS
r_cur_rest TAB_TYPES_PKG.cur_rest_r;
BEGIN
r_cur_rest.STR_NAME := 'ROW 1';
r_cur_rest.INFO := '10';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 2';
r_cur_rest.INFO := '20';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 3';
r_cur_rest.INFO := '30';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 4';
r_cur_rest.INFO := '40';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 5';
r_cur_rest.INFO := '50';
PIPE ROW (r_cur_rest);
RETURN;
END TEST_FUNC;
- I created List View Report on Page 1:
Region Source:
SELECT str_name,
info
FROM TABLE (TEST_FUNC)
We can see error ORA-01007 after refresing (or submiting) Page 1 three times or more.
How to fix it?Hi all
I'm experiencing the same issue. Predictably on every third refresh I receive:
Error
Error during rendering of region "Results".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 6910805644140264
component.name: Results
error_backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
OK
I am running Application Express 4.2.2.00.11 on GlassFish 4 using Apex Listener 2.0.3.221.10.13.
Please note: this works perfectly using a classic report in my desktop application; however, no joy on the mobile side with a list view. I will use a classic report in the interim.
My region source is as follows:
SELECT description AS "DESCRIPTION", reference AS "REFERENCE" FROM TABLE(AUTOCOMPLETE_LIST_VIEW_FNC('RESULTS'))
The procedure:
FUNCTION AUTOCOMPLETE_LIST_VIEW_FNC(
p_collection_name IN VARCHAR2)
RETURN list_row_table_type
AS
v_tab list_row_table_type := list_row_table_type();
BEGIN
DECLARE
jsonarray json_list;
jsonobj json;
json_clob CLOB;
BEGIN
SELECT clob001
INTO json_clob
FROM apex_collections
WHERE collection_name = p_collection_name;
jsonobj := json(json_clob);
jsonarray := json_ext.get_json_list(jsonobj, 'predictions');
FOR i IN 1..jsonArray.count
LOOP
jsonobj := json(jsonArray.get(i));
v_tab.extend;
v_tab(v_tab.LAST) := list_row_type(json_ext.get_string(jsonobj, 'description'), json_ext.get_string(jsonobj, 'reference'));
END LOOP;
RETURN(v_tab);
END;
END AUTOCOMPLETE_LIST_VIEW_FNC;
Thanks!
Tim -
Inserting a new row in a BC4J View Object with an attribute of type BFileDomain
Hi all,
I've to insert a row in a View Object with an attribute of type oracle.jbo.domain.BFileDomain.
I do this within an Application Module's method, which has an input parameter of type byte[]. This parameter will be the content of the BFILE.
What's the right way for doing that?
I've tried with the following code, but I've got an exception in committing the transaction:
public int serializeDocument(int codDomanda, int codSorgente, byte[] content, String est, int type, int cost, String title, String arg) throws JboException {
int code = 0;
//File f;
DocumentiTwoView = getDocumentiTwoView();
java.sql.Statement stmt = ((DBTransaction) getTransaction()).createStatement(1);
try {
Row docRow = DocumentiTwoView.createRow();
SequenceImpl seq = new SequenceImpl("documenti_seq", getDBTransaction());
Integer next = (Integer) seq.getData();
code = next.intValue();
docRow.setAttribute("Coddocumento", new Number(code));
docRow.setAttribute("Titolo", (String) title);
docRow.setAttribute("Argomento", (String) arg);
docRow.setAttribute("Costo", new Number(cost));
docRow.setAttribute("Tipo", new Number(type));
docRow.setAttribute("Coddomanda", new Number(codDomanda));
docRow.setAttribute("Codsorgente", new Number(codSorgente));
//f = new File("Doc" + code + "." + est)
BFILE src_lob = null;
ResultSet rset = null;
rset = stmt.executeQuery ("SELECT BFILENAME('DOC_DIR', 'Doc" + code + "." + est + "') FROM DUAL");
if (rset.next()) {
src_lob = ((OracleResultSet)rset).getBFILE(1);
BFileDomain bfd = new BFileDomain(src_lob);
bfd.setBytes(content);
bfd.saveToDatabase(getTransaction());
docRow.setAttribute("Contenuto", (BFileDomain) bfd);
catch (Exception ex) {
getTransaction().rollback();
throw new oracle.jbo.JboException("Impossibile creare il nuovo documento:\n" + ex.getMessage());
finally {
try {
stmt.close();
catch (Exception nex) {
try {
// Commit the whole transaction
getTransaction().commit();
catch (Exception e) {
e.printStackTrace();
getTransaction().rollback();
throw new JboException("Impossibile eseguire il commit della transazione:\n" + e.getMessage());
return code;
Thanks a lot in advance!
Christian
nullOdd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones. -
Query in bc4j view object?
I am creating a vo based on employees table(hr demo schema) . It has managerid column , i want to display manager name instead of managerid. So in my view object i want
Employees : FirstNAme, Lastname, email and managername.
How to do a query like ' select firstname from employee where employeeid= 100' . (which is current employees managerid) in the vo.??
So that managerid gets converted to managername for each employee.Dhiraj,
I would add the manager name and have the manager id as a hidden filed in your application. Set attribute property in display hints to display hide. This way the manager id is present but not shown.
Frank -
Java access to view objects from uix page provider
I have a java method called from a uix page as follows:
<dataScope>
<provider>
<data name="frameworkTableData">
<method class="smart.FrameworkAspects"
method="getFrameworkStudyAspects"/>
</data>
</provider>
I want the java program to be able to access the bc4j view objects defined on the page. These are:
<bc4j:registryDef>
<bc4j:rootAppModuleDef name="SmAspectsBrowseAppModule"
definition="smart.Smartbc4jModule"
releaseMode="stateful" >
<bc4j:viewObjectDef name="SmFrameworksBrowse"
rangeSize="0" />
<bc4j:viewObjectDef name="SmAspectsBrowse"
rangeSize="10" />
<bc4j:viewObjectDef name="SmStudyMembersAspectsEdit" />
</bc4j:rootAppModuleDef>
</bc4j:registryDef>
I've read through several of the threads on using Configuration.createRootApplicationModule(amDef, config) and it is not clear what it is looking for in the arguments. It appears that "config" is the name of the app module. I don't know what the amDef relates to.
Anyway, I can't get it to work. All I'm trying to do is get at 3 view objects I have defined in my bc4j section and am having trouble getting this to work.
Any ideas on how to approch this would be much appreciated.
Thanks, Steve
Does anyoneCan you explain how you solved the problem? I have the same. Thanks.
-
Uppercase Attributes in View Object
Hi
Any one help me please on BC4J View Object Attributes should display in Uppercase only. currently default is InitCap.
much appreciate your help.
Regards
SriniHi Frank,
Thanks for the suggestion.
I followed the link.But if a transient attribute is modified,then also ((ApplicationModule)getDataProvider()).getTransaction().isDirty() is returning true and the transaction is made dirty.
I am setting a transient attribute like this getNwOperVOIter().getCurrentRow().setAttribute("AcctNoTrans")....when I am editing a row.
Can I get explicit handle at viewobjectimpl for this transient attribute??
Regards,
Praveen -
RowSetInfo; bc4j; how to get the View Object
So I'm trying to get/update/insert/delete records in a database that contain an interMedia image in a blob.
I've figured out that I can't simply set the ImmediateAccess attribute. It doesn't like that...
So I'm trying to go after the view object, since the interMedia white paper uses a VO row setAttribute to accomplish the write.
RowSetInfo extends ResultSetInfo which has a method getViewObject(). Cool.
So I try it... and get an error that getViewObject() has protected access.
Anyone know what I am doing wrong? Or should I be even taking this approach?!?!?!
If I go exclusively with the VO layer... how do I preserve the navigationBar functionality? Or do I need to roll my own?
( NOTE: This hilights another example of the perception of 'friction' between rowsetinfos and the view objects/entity objects. An approach that makes "sense" to me as a naive novice didn't pan out. And oddly, most of the bc4j examples go against VOs when, if you are an application programmer, you may never see or use the VO methods ( although it looks like we should be)... we're working at the ResultSetInfo layer. )
Is the the observation of other folk who are building Java Applications/Applets? Or do you all work directly with VOs instead of going through the ResultSetInfo "layer"?Here is some sample code that I am currently working on and will post on OTN when complete. The code shows how to access a BC4J Domain based on an Oracle type. Working with interMedia is similar since interMedia utilizes Oracle Object types. Please note that I have not tested this yet against interMedia, but I'm hoping that you may find the general process useful.
// Copyright (c) 2000 Oracle Corporation
package ObjectSampleDAC;
import oracle.dacf.control.swing.*;
import javax.swing.*;
import oracle.dacf.dataset.*;
import oracle.dacf.dataset.connections.*;
import java.awt.*;
import oracle.jdeveloper.layout.*;
import java.awt.event.*;
import javax.infobus.*;
import oracle.jbo.domain.DomainInterface;
import ObjectSampleBC4J.common.TAddress;
import java.sql.SQLException;
* A Frame class.
* <P>
* @author Scott Tiger
public class Frame1 extends InfoFrame {
* Constructs a new instance.
public Frame1() {
super();
try {
jbInit();
sessionInfo1.publishSession();
// call my initialization method
bfInit();
catch (Exception e) {
e.printStackTrace();
* Initializes the state of this instance.
private void jbInit() throws Exception {
/* All of the following code in this method was added by the designer except where noted below
EmailrowSetInfo1.setName("Email");
jPanel3.setLayout(gridBagLayout1);
StatusrowSetInfo1.setName("Status");
AddressrowSetInfo1.setName("Address");
PasswordrowSetInfo1.setName("Password");
UsernamerowSetInfo1.setName("Username");
LastnamerowSetInfo1.setName("Lastname");
FirstnamerowSetInfo1.setName("Firstname");
IdrowSetInfo1.setName("Id");
rowSetInfo1.setAttributeInfo( new AttributeInfo[] {
IdrowSetInfo1,
FirstnamerowSetInfo1,
LastnamerowSetInfo1,
UsernamerowSetInfo1,
PasswordrowSetInfo1,
AddressrowSetInfo1,
StatusrowSetInfo1,
EmailrowSetInfo1} );
this.setDataItemName("infobus:/oracle/sessionInfo1");
this.setTitle("Customer Information");
this.getContentPane().setLayout(borderLayout1);
this.setSize(new Dimension(536, 473));
jPanel1.setLayout(borderLayout2);
sessionInfo1.setAppModuleInfo(new ModuleInfo("ObjectSampleBC4J", "ObjectSampleBC4JModule"));
sessionInfo1.setConnectionInfo(new LocalConnection("MyJdbcConn"));
sessionInfo1.setName("sessionInfo1");
rowSetInfo1.setQueryInfo(new QueryViewInfo(
"CustomerView",
rowSetInfo1.setSession(sessionInfo1);
rowSetInfo1.setName("rowSetInfo1");
/* The following listener was added using the event tab in the property inspector in design
mode. The rowsetPopulated method is called when the rowset is queried/requeried.
rowSetInfo1.addChangeListener(new oracle.dacf.dataset.ChangeAdapter() {
public void rowsetPopulated(RowSetChangeEvent e) {
rowSetInfo1_rowsetPopulated(e);
textFieldControl1.setText("textFieldControl1");
textFieldControl2.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Firstname");
textFieldControl2.setText("textFieldControl2");
textFieldControl3.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Lastname");
textFieldControl3.setText("textFieldControl3");
textFieldControl4.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Username");
textFieldControl4.setText("textFieldControl4");
textFieldControl5.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Password");
textFieldControl5.setText("textFieldControl5");
textFieldControl6.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Status");
textFieldControl6.setText("textFieldControl6");
textFieldControl7.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Email");
textFieldControl7.setText("textFieldControl7");
navigationBar1.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1");
jLabel1.setText("ID:");
jLabel2.setText("First Name:");
jLabel3.setText("Last Name:");
jLabel4.setText("User Name:");
jLabel5.setText("Password:");
jLabel6.setText("Status:");
jLabel7.setText("Email:");
jLabel8.setText("Address:");
jPanel4.setLayout( gridBagLayout2);
textFieldStreet.setColumns(20);
textFieldStreet.setText("textFieldStreet");
/* The following listener (as well as the listeners on textFieldCity, textFieldState, and
textFieldZipcode were added by the designer, but the focusGained and focusLost methods
were modified in each case to call a common textField_focusGained method
textFieldStreet.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
textField_focusGained(e);
public void focusLost(FocusEvent e) {
textField_focusLost(e);
textFieldCity.setColumns(20);
textFieldCity.setText("textFieldCity");
textFieldCity.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
textField_focusGained(e);
public void focusLost(FocusEvent e) {
textField_focusLost(e);
textFieldState.setColumns(20);
textFieldState.setText("textFieldState");
textFieldState.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
textField_focusGained(e);
public void focusLost(FocusEvent e) {
textField_focusLost(e);
textFieldZipcode.setColumns(20);
textFieldZipcode.setText("textFieldZipcode");
textFieldZipcode.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(FocusEvent e) {
textField_focusGained(e);
public void focusLost(FocusEvent e) {
textField_focusLost(e);
jLabel9.setText("Street:");
jLabel10.setText("City:");
jLabel11.setText("State:");
jLabel12.setText("Zip Code:");
textFieldControl1.setDataItemName("infobus:/oracle/sessionInfo1/rowSetInfo1/Id");
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel1.add(jPanel2, BorderLayout.NORTH);
jPanel2.add(navigationBar1, null);
jPanel1.add(jPanel3, BorderLayout.CENTER);
jPanel3.add(textFieldControl1, new GridBagConstraints2(1, 0, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(37, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl2, new GridBagConstraints2(1, 1, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(7, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl3, new GridBagConstraints2(1, 2, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(7, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl4, new GridBagConstraints2(1, 3, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(6, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl5, new GridBagConstraints2(1, 4, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(6, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl6, new GridBagConstraints2(1, 5, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(7, 11, 0, 0), 0, 0));
jPanel3.add(textFieldControl7, new GridBagConstraints2(1, 6, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(6, 11, 0, 0), 0, 0));
jPanel3.add(jLabel1, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(37, 106, 0, 0), 0, 0));
jPanel3.add(jLabel2, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 54, 0, 0), 0, 0));
jPanel3.add(jLabel3, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 54, 0, 0), 0, 0));
jPanel3.add(jLabel4, new GridBagConstraints2(0, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 54, 0, 0), 0, 0));
jPanel3.add(jLabel5, new GridBagConstraints2(0, 4, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 62, 0, 0), 0, 0));
jPanel3.add(jLabel6, new GridBagConstraints2(0, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(9, 83, 0, 0), 0, 0));
jPanel3.add(jLabel7, new GridBagConstraints2(0, 6, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(9, 86, 0, 0), 0, 0));
jPanel3.add(jLabel8, new GridBagConstraints2(0, 7, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(7, 72, 94, 0), 0, 0));
jPanel3.add(jPanel4, new GridBagConstraints2(1, 7, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel4.add(textFieldZipcode, new GridBagConstraints2(1, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
jPanel4.add(textFieldState, new GridBagConstraints2(1, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
jPanel4.add(jLabel9, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel4.add(textFieldStreet, new GridBagConstraints2(1, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
jPanel4.add(jLabel10, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel4.add(jLabel11, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel4.add(jLabel12, new GridBagConstraints2(0, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel4.add(textFieldCity, new GridBagConstraints2(1, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 10, 0, 0), 0, 0));
/* The following vaiable declarations were made by the designer
BorderLayout borderLayout1 = new BorderLayout();
JPanel jPanel1 = new JPanel();
SessionInfo sessionInfo1 = new SessionInfo();
RowSetInfo rowSetInfo1 = new RowSetInfo();
AttributeInfo IdrowSetInfo1 = new AttributeInfo(java.sql.Types.NUMERIC);
AttributeInfo FirstnamerowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo LastnamerowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo UsernamerowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo PasswordrowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo AddressrowSetInfo1 = new AttributeInfo();
AttributeInfo StatusrowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
AttributeInfo EmailrowSetInfo1 = new AttributeInfo(java.sql.Types.VARCHAR);
JPanel jPanel2 = new JPanel();
JPanel jPanel3 = new JPanel();
TextFieldControl textFieldControl1 = new TextFieldControl();
TextFieldControl textFieldControl2 = new TextFieldControl();
TextFieldControl textFieldControl3 = new TextFieldControl();
TextFieldControl textFieldControl4 = new TextFieldControl();
TextFieldControl textFieldControl5 = new TextFieldControl();
TextFieldControl textFieldControl6 = new TextFieldControl();
TextFieldControl textFieldControl7 = new TextFieldControl();
BorderLayout borderLayout2 = new BorderLayout();
NavigationBar navigationBar1 = new NavigationBar();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
GridBagLayout gridBagLayout1 = new GridBagLayout();
JPanel jPanel4 = new JPanel();
JTextField textFieldStreet = new JTextField();
JTextField textFieldCity = new JTextField();
JTextField textFieldState = new JTextField();
JTextField textFieldZipcode = new JTextField();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
JLabel jLabel12 = new JLabel();
GridBagLayout gridBagLayout2 = new GridBagLayout();
/* The following declarations were made manually
/* DomainAccess provides a means for getting and setting values of a column object as domain
DomainAccess da = null;
/* TAddress is the domain class
TAddress addr = null;
/* Declare variables for determining if JTextField values have been changed by user
String oldVal = null;
String newVal = null;
/* The following method is generated by the wizard when the frame was created
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSED) {
System.exit(0);
public void bfInit () throws Exception {
/* To add code to be invoked when the user moves from one row to another, get the
DataItemChangeManager from the RowSetInfo (via RowsetAccess) and add a
DataItemChangeListener. The specific method we want to use here is rowsetCursorMoved
which is invoked when the user moves from one row to another; the other methods are
defined simply because the interface requires them.
RowsetAccess ra = rowSetInfo1.getRowsetAccess();
DataItemChangeManager dcm = (DataItemChangeManager)ra;
dcm.addDataItemChangeListener(new DataItemChangeListener() {
public void rowsetCursorMoved(RowsetCursorMovedEvent e) {
rowSetInfo1_rowsetCursorMoved(e);
public void dataItemAdded(DataItemAddedEvent e) {
public void dataItemDeleted(DataItemDeletedEvent e) {
public void dataItemRevoked(DataItemRevokedEvent e) {
public void dataItemValueChanged(DataItemValueChangedEvent e) {
/* This method was generated by the designer. See rowSetInfo1.addChangeListener(...) in jbInit
above.
void rowSetInfo1_rowsetPopulated(RowSetChangeEvent e) {
try {
/* When the rowset is populated, set the JTextField values based on the domain. See
updateFields() below.
updateFields();
catch (Exception ex) {
System.out.println("Error occurred while retrieving values");
ex.printStackTrace();
/* This method was added manually to track row navigation. See dcm.addDataItemChangeListener(...)
in jbInit above.
void rowSetInfo1_rowsetCursorMoved(RowsetCursorMovedEvent e) {
try {
/* When the user moves from one row to another, set the JTextField values based on the
domain. See updateFields() below.
updateFields();
catch (Exception ex) {
System.out.println("Error occured while assigning values");
ex.printStackTrace();
/* This method finds the values from each field of the column object by using the domain, then
sets the values of the JTextFields respectively. It is invoked when the rowset is initially
populated, and each time the user moves from one row to another.
public void updateFields () throws Exception {
/* Get DataItem for the Address column object and cast to DomainAccess for to prepare for
getting and setting column value as domain.
da = (DomainAccess)AddressrowSetInfo1.getImmediateAccess();
/* Get the value of the attribute as a Domain and cast to DomainInterface.
DomainInterface di = da.getValueAsDomain();
/* null out addr. Otherwise, if the address column is null for a particular record, when
the user navigates to the record with the null values, addr will retain the previous record's
values. This ensures a clean slate.
addr = null;
/* Using DomainInterface allows us to cast the domain object to the specific Domain class for
that type. So, cast the address attribute's value to TAddress, the class that
represents the T_ADDRESS type created in the database. This provides getters and setters
for each of the fields of the Object Type.
if ( di instanceof TAddress ) {
addr = (TAddress) di;
/* If the above statement resulted in some non-null object assigned to addr, it is because
one or more of the fields of the domain contained non-null values. Therefore, if addr is
not null, get the values from each field of the domain and assign them to their
respective JTextFields. Otherwise, set each JTextField to an empty string.
if (addr != null) {
textFieldStreet.setText(addr.getStreet());
textFieldCity.setText(addr.getCity());
textFieldState.setText(addr.getState());
textFieldZipcode.setText(addr.getZipcode());
else {
textFieldStreet.setText("");
textFieldCity.setText("");
textFieldState.setText("");
textFieldZipcode.setText("");
/* If addr is null, after making sure the JTextFields are cleared, create a new TAddress
object so that we have something to assign values to if the user edits the JTextFields.
try {
addr = new TAddress();
catch (SQLException ex) {
System.out.println("Error creating domain TAddress");
ex.printStackTrace();
/* The method below is invoked when the user navigates to textFieldStreet, textFieldCity,
textFieldState, or textFieldZipcode. It's used just to find the value of the field when
the user enters the field (the "before" value).
void textField_focusGained(FocusEvent e) {
Object obj = e.getSource();
if (obj instanceof JTextField) {
JTextField field = (JTextField)obj;
oldVal = field.getText();
/* The method below is invoked when the user navigates away from textFieldStreet, textFieldCity,
textFieldState, or textFieldZipcode. It checks to see if the user changes the value of the
field, and if so, updates the value of the address attribute.
void textField_focusLost(FocusEvent e) {
/* Find out the value of the JTextField now that the user is attempting to leave the field.
Object obj = e.getSource();
if (obj instanceof JTextField) {
JTextField field = (JTextField)obj;
newVal = field.getText();
/* Compare the new value of the field ("after" value) to the "before" value captured
in textField_focusGained above. If they are equal, we do nothing. If they are not equal,
then the user must have changes the value in the field, and we have some work to do.
if (!oldVal.equals(newVal)) {
/* Since this same method is called regardless of which JTextField has been left, we find
out which text field the user is leaving, and then set the value of the appropriate
element of the addr domain.
if (obj.equals(textFieldStreet)) {
addr.setStreet(newVal);
if (obj.equals(textFieldCity)) {
addr.setCity(newVal);
if (obj.equals(textFieldState)) {
addr.setState(newVal);
if (obj.equals(textFieldZipcode)) {
addr.setZipcode(newVal);
/* So, we've set the value of the appropriate element of the addr domain, but we have not
"posted" those changes to the BC4J (middle-tier), so if we were to commit at this point
our changes would not get saved to the database (because BC4J is not aware of these
changes). The next step is to notify BC4J of the changes.
try {
da.setValueAsDomain(addr);
catch (InvalidDataException ex) {
System.out.println("Invalid Data assigned to TAddress");
ex.printStackTrace();
/* Clear out the oldVal and newVal variable so we are ready to track more changes.
oldVal = null;
newVal = null;
}-- Brian -
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 put validation between attributes at View Object level in BC4J
Hi,
Is it possible in BC4J to put validation between attributes at View Object level?
I know that I can do it at Entity Object level in validateEntity method, but I have several View Objects connected with one Entity Object and don't want to have the same validation logic for all View Objects.
Thanks for any help!It returns errorWhat error does it return?
John -
Can we call custom functions in view objects?
Can we call custom functions in view objects?these custom functions are from my backing bean...
Please help.....User,
You can certainly add code to your view objects to do whatever you like.
However, it would be considered a very bad practice to call something in the backing bean from your view object. It violates the whole MVC design principle of ADF.
Perhaps if you can share your real use case, someone will give you ideas about the best way to do it, but I, for one, would advise you to forget about calling a backing bean function from your view object.
Best,
John -
BC4J: embedding Special SQL in View Objects
While BC4J allows for easier development because developers do not need to embed a lot of SQL in Java codes, I wonder how I could embed special SQLs either into my Java code or in the View Object Wizard. For example, the following SQL statement could not be entered into the View Object Wizard:
select key1, key2, SCORE(10),SCORE(20)
from table1
where contains (attrib1, 'apple', 10) >0 OR
contains (attrib1, 'orange', 20) > 0
Order by NVL(SCORE(10),0), NVL(SCORE(20),0);
How can I embed the above SQL statement properly in a View Object? Or do I have to write SQLJ code outside of a View Object?As you mentioned BC4J gives the flexibility of using all valid SQL statements.
For you query above, you would have to do the following.
You would need to create caluclated attributes for SCore(10) and score(20)
Select the ViewObject in Navigator and edit it (right mouse button)
Select Attributes Tab
Click on New attribute Score(10) and you can give an alias name for that.
same goes for score(20) also.
Select query tab now
Choose expert mode check box
Paste your query in the text box
and Orderby clause in the orderby textbox
click on the test button to test it
raghu -
Record vs object vs globle table in pipelined function
i want to make pipeline function , i show it can be made in following ways
please suggest which one is better in performance and maintenance.
1)
create type my_tab_type is object
(prodid number, a varchar2(1), b varchar2(1),
c varchar2(1), d varchar2(1), e varchar2(1))
create type my_tab_type_coll is table of my_tab_type;
create or replace function get_some_data (p_val in number)
return my_tab_type_coll pipelined is
begin
FOR i in (select * from my_table where prodid=p_val) loop
pipe row(my_tab_type(i.prodid,i.a,i.b,i.c,i.d,i.e));
end loop;
return;
end;
SELECT * FROM table(get_Some_Data(3));
2)
one can create globle tem table "Tlb_3". then can make a package like fllowing
create or replace
PACKAGE pk1
AS
TYPE T_type IS TABLE OF Tlb_3%ROWTYPE;
END;
and rest of the thing will be same like first one.
3)
TYPE outrec_typ IS RECORD (
var_num NUMBER(6),
var_char1 VARCHAR2(30),
var_char2 VARCHAR2(30)
TYPE outrecset IS TABLE OF outrec_typ;
and rest of the thing will be same like first one
so main question is relating to declaretion of TABLE which is returned.
yours sincerely
Edited by: 944768 on Jan 2, 2013 4:23 AMDUPLICATE THREAD!
How many times do you intend to ask this question?
This is the same question that you ask, and got answered, six months ago in this thread?
how to write Function returing table or set of rows.
And you ask it again a week ago in this thread
object vs record in pipelined function.
Have you forgotten those answers already? Why didn't you take the advice given there and perform some tests?
And you don't seem to acknowledge any of the help you get to your questions by marking them ANSWERED when they have been.
Please revisit this 32 questions and mark them ANSWERED as appropriate - Total Questions: 73 (32 unresolved)
>
i want to make pipeline function , i show it can be made in following ways
please suggest which one is better in performance and maintenance.
>
Why didn't you take the advice given there and perform some tests?
Option #1, using SQL types is better, especially for maintenance. Also SQL types are required if the function is going to be called from SQL. You can define PL/SQL or %ROWTYPE package variables and use them but Oracle will silently create 'hidden' (in 11g) SQL types and use those.
See Solomon's explanation and sample code in this recent thread
Re: Pipe line function
There certainly isn't any need to create a global temp table just so you can create the %ROWTYPE variable; you can create one of those based on a CURSOR. -
BC4J: Question on bind variables and DML in view objects
Hello,
I have a view object with a bind variable in the WHERE clause of the underlying query. I'm curious about how the state of this bind variable affects the use of the view object for inserting, updating, etc., at various stages of the commit cycle (before posting changes, after posting changes, after commit).
Specifically, what happens in the following scenarios?
1. The bind variable is not bound (and the query has not been executed) and a row is inserted into the VO
2. The bind variable is set to some value and an inserted or updated row in the VO does not meet the criteria specified by the bind variable; the transaction is then committed
If there is a weblog entry, help file, or HOWTO somewhere, I'd welcome a link to it.
Thanks,
AlanThe variable would only come into play when the VO's query is executed. It can be executed implicitly -- for example, accessing the first() row if the query hasn't been executed yet -- or explicitly by a call to executeQuery().
By setting setMaxFetchSize(0) on your VO, no rows will be fetched and you can use the VO for insert only. -
BC4J: problems creating view object with multiple entity objects
Hi,
I working with a view object which contains two entity objects with parent-child relationship like this:
ViewObject - ParentEntityObject - PId
PAttribute
CId (FK)
(- ParentChildAssociation)
- ChildEntityObject - CId
- CAttribute
The 'Read Only' and 'References' options are checked for the association in the view object.
I'm creating a new row using this view object. The parent object should be created new and the child object already exists in the database, so I'm setting only the attributes of the parent object (including foreign key).
After creating the row I display it in a jbo:DataTable and only those attributes coming from the parent object are displayed. The attributes of the child object are not set. After a commit all attributes appear.
The problem is, that I want to display the new row with all attributes to the users BEFORE they commit.
I tried to set the child attributes, but they are read only by definition and even when I unchecked the 'Read Only' option and set the attributes to 'Always Updateable' in the view object it is giving me
JBO-27008: Attribute set for CAttribute in view object ViewObject failed.
Is there a way to make all attributes of the child object visible in the view object without committing changes?
(JDev 9.0.2.822)
Any help would be appreciated.
Regards,
ChristianOnce again the structure, sorry.
ViewObject
|-ParentEntityObject
..|-PId
..|-PAttribute
..|-CId (FK)
|-ParentChildAssociation
|-ChildEntityObject
..|-CId
..|-CAttribute
Christian
Maybe you are looking for
-
How to delete text vertically in Pages
I have a log of text messages that me and my friend have had, and I want to delete the time informations from it. The example below will help you understand the situation. 2012/7/16 4:30, Me : Blah blah 2012/7/16 4:31, A : Blah blah 2012/7/16 4:32, M
-
Hi There, I am having massive issues with my Exchange Server. I have 2 Nodes, one has CAS and Mailbox Roles, the other just Mailbox. I "upgraded" the CAS server to CU7 without any errors / issues. Once I had restarted, nothing worked any more.. I co
-
Stuck trying to install Windows 7 Ultimate on X120e (Help please)
I just got my x120e yesterday and it came loaded with Windows 7 Home Premium. Since my college offers free Windows 7 Ultimate I decided I would go ahead and install that, plus since I bought the computer used I figured that would be a good clean star
-
Printing with Adobe reader produces blurry fonts
Hello, I've recently bought a Canon Pixma MP220, installed and updated with the latest drivers for OSX 10.4 from the Canon website. When I print pdf documents with the Adobe reader (8.1.2), the printed fonts are really blurry and the speed of the pri
-
Basically: I'm trying this forum now as a last resort since I've simply tried everything. PROBLEM: My phone just randomly resets whenever it feels like it in no set time occurence i.e. It can reset once then straight after or resets and then is fine