Invalid precision/scale

hi when i select a value in my LOV AM GETING THIS ERROR invalid precision/scale
my LOV IS
<ViewAttribute
    Name="Orgsubtypecode1"
    IsNotNull="true"
    PrecisionRule="true"
    EntityAttrName="Orgsubtypecode"
    EntityUsage="LutOrgsubtypes"
    AliasName="ORGSUBTYPECODE1"
    LOVName="LOV_Orgsubtypecode1">
    <Properties>
      <SchemaBasedProperties>
        <CONTROLTYPE
          Value="choice"/>
      </SchemaBasedProperties>
    </Properties>
  </ViewAttribute>my stack error is
oracle.jbo.AttrSetValException: JBO-27010: Attribute set with value DBE for Orgsubtypecode in AppModule.OrgDetails1 has invalid precision/scale
     at oracle.jbo.rules.RulesBeanUtils.createException(RulesBeanUtils.java:381)
     at oracle.jbo.rules.RulesBeanUtils.createException(RulesBeanUtils.java:360)
     at oracle.jbo.rules.AbstractValidator.createException(AbstractValidator.java:1077)
     at oracle.jbo.rules.AbstractValidator.doRaiseException(AbstractValidator.java:1120)
     at oracle.jbo.rules.AbstractValidator.raiseException(AbstractValidator.java:1109)
     at oracle.jbo.rules.JboAbstractValidator.raiseException(JboAbstractValidator.java:409)
     at oracle.jbo.rules.AbstractValidator.raiseException(AbstractValidator.java:1096)
     at oracle.jbo.rules.JboAbstractValidator.callValidateValueWithContext(JboAbstractValidator.java:239)
     at oracle.jbo.rules.JboAbstractValidator.validate(JboAbstractValidator.java:386)
     at oracle.jbo.rules.RulesBeanUtils.validateObject(RulesBeanUtils.java:716)
     at oracle.jbo.rules.RulesBeanUtils.validate(RulesBeanUtils.java:696)
     at oracle.jbo.server.AttributeDefImpl.validate(AttributeDefImpl.java:3349)
     at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:3294)
     at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:2012)
     at ecadastre.gov.za.model.entities.UamOrganisationsImpl.setOrgsubtypecode(UamOrganisationsImpl.java:501)
     at ecadastre.gov.za.model.entities.UamOrganisationsImpl$AttributesEnum$14.put(UamOrganisationsImpl.java:159)
     at ecadastre.gov.za.model.entities.UamOrganisationsImpl.setAttrInvokeAccessor(UamOrganisationsImpl.java:531)
     at oracle.jbo.server.EntityImpl.setAttribute(EntityImpl.java:1920)
     at oracle.jbo.server.ViewRowStorage.setAttributeValue(ViewRowStorage.java:2363)
     at oracle.jbo.server.ViewRowStorage.setAttributeInternal(ViewRowStorage.java:2165)
     at oracle.jbo.server.ViewRowImpl.setAttributeInternal(ViewRowImpl.java:1453)
     at oracle.jbo.server.ViewRowImpl.setAttrInvokeAccessor(ViewRowImpl.java:1428)
     at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1089)
     at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1029)
     at oracle.jbo.server.ViewRowImpl.setAttributeValues(ViewRowImpl.java:1703)
     at oracle.adf.model.binding.DCDataControl.setAttributesInRow(DCDataControl.java:2428)
     at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeValuesInRow(JUCtrlValueBinding.java:976)
     at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRow(JUCtrlListBinding.java:2801)
     at oracle.jbo.uicli.jui.JUComboBoxCtrlBinding.updateTargetFromSelectedValue(JUComboBoxCtrlBinding.java:793)
     at oracle.jbo.uicli.jui.JUComboBoxCtrlBinding.actionPerformed(JUComboBoxCtrlBinding.java:702)
     at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
     at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
     at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:603)
     at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:817)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
     at java.awt.Component.processMouseEvent(Component.java:6289)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
     at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:481)
     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)

Can you check whats the precision/scale and datatype of the attribute from corresponding EO attribute. That will clarify things.

Similar Messages

  • Invalid precision/scale on combo box

    I am dragging a field over to a table view on a panel as a combo box. I go to the list binding editor to setup the data to choose from in the combo box. I am using the LOV mode to get the data from another table. Everything looks good when I test the form. The combobox shows the data from the table that i'm getting it from. The problem is when i try to change the data on the form. I'm am getting an error message stating invalid precision/scale. The field from the source LOV is named CustomerName, setup as Varchar2(30). The field in the Target attribute is named CustomerAssigned, setup as Varchar2(30). Is the problem somewhere else and this error message an erroneous message? Help!!

    After much hair pulling, what I did was created a new View link of the table i used for the source, then named the field in new view link as the same as the target field and it worked. Let me see if I can explain.
    Source: Customer_Master / Customer_Name
    Target: Line1ProperziDtl / Customer_Assigned
    The above gave me the error message. I then created a new view link from the Customer_Master:
    Source: CustAssignedMaster / Customer_Assigned
    Target: Line1ProperziDtl / Customer_Assigned.
    This worked with no errors. Why would it matter what the field names are as long as the Datatype and Sizes are the same?

  • JBO-27010: Attribute set ... has invalid precision/scale

    We have created a table ACCOUNT with a column RATE defined as NUMBER(5, 3).
    Bc4j has created the corresponding entity object Account with:
    <Attribute
    Name="Rate"
    Type="oracle.jbo.domain.Number"
    ColumnName="RATE"
    ColumnType="NUMBER"
    SQLType="NUMERIC"
    IsNotNull="true"
    Precision="5"
    Scale="3"
    TableName="ACCOUNT" >
    Also the corresponding view object AccountView has been created.
    Here is the java code (JDeveloper Ver.3.2.3) where we catch an exception:
    ViewObject vo = applicationModule.findViewObject("AccountView");
    Row r = vo.createRow();
    String rateStr = "12,725"; // comma used locally as decimal separator
    oracle.jbo.domain.Number rateN = new oracle.jbo.domain.Number(rateStr);
    r.setAttribute("Rate", rateN);
    The exception is:
    oracle.jbo.AttrSetValException: JBO-27010: Attribute set with value 12,725 for Rate in Account has invalid precision/scale
    Any help would be greatly appreciated.
    Thanks in advance.
    null

    I like to tell you that now everything is ok.
    Looking at the libraries included in my project, I found an unecessary library "JBO Generic Domains" (X:\Program Files\Oracle\JDeveloper 3.2.3\lib\jbodomgnrc.zip) containing a class oracle.jbo.domain.Number different from the right one in "JBO Oracle Domains" (X:\Program Files\Oracle\JDeveloper 3.2.3\lib\jbodomorcl.zip).

  • No error when Method Operation sets invalid precision in EO

    Hi,
    I stumbled upon a very strange behavior (bug ?) reproduced in the following simple test case.
    Studio Edition Version 11.1.2.3.0, Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1
    Using HR with default VO & EO for the regions table, I create a client interface AM method where sets an invalid value to the RegionName attribute:
        public void updateWithIllegalValueFromAM(){
            try {
                getRegions1().getCurrentRow().setAttribute("RegionName", "012345678901234567890123456789"); // (1)invalid precision/scale should be max 25 chars
            } catch (Exception e) {
                e.printStackTrace();//<-- Never executed
                throw new JboException(e); //<-- Never executed
            System.out.println("  updateWithIllegalValueFromAM End ");
        }Next in the JSP I create a read only form for the Region1 VO, including navigation, a button for the method operation and finally a commit operation.
    Running the above and pressing the method operation button, the expected behavior is to see an error message but it is never shown until the transaction being committed.
    Debugging I see that an exception is raised in the setter of the attribute but it doesn’t bubble up till the (1) catch statement.
    As you might guess the real case is a read only screen with buttons for making actions for the current record . I assumed that the EO validations should be honored in such scenario but I am wrong …
    If you have any clue why this happens please share it with me!
    Yiannis
    Edited by: Tses on Mar 22, 2013 1:06 AM

    Thanks Sudipto,
    I inserted the try/catch block for debugging, just to ensure that catch is never executed, that is the e.printStackTrace is not printed.
    To be more clear I edited the above code.
    Yiannis

  • Java.sql.SQLException: Invalid precision value. Cannot be less than zero

    Hi,
    In my portlet application have several jsf tables which bind to several oracle tables. I have tested the portlet in pluto and tried to deploy it on liferay. However, I get an exception stating:
    java.sql.SQLException: Invalid precision value. Cann
    ot be less than zero
    What could this exception mean? Has anyone else encountered this?
    Marc
    P.S. The trace is shown below:
    Feb 6, 2007 12:34:56 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.RuntimeException: java.sql.SQLException: Invalid precision value. Cann
    ot be less than zero
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(Cach
    edRowSetDataProvider.java:343)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(Ca
    chedRowSetDataProvider.java:300)
    at com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(Cache
    dRowSetDataProvider.java:624)
    at com.sun.rave.web.ui.component.TableRowGroup.getRowKeys(TableRowGroup.
    java:806)
    at com.sun.rave.web.ui.component.TableRowGroup.getFilteredRowKeys(TableR
    owGroup.java:429)
    at com.sun.rave.web.ui.component.TableRowGroup.getRowCount(TableRowGroup
    .java:749)
    at com.sun.rave.web.ui.component.Table.getRowCount(Table.java:307)
    at com.sun.rave.web.ui.renderer.TableRenderer.renderTitle(TableRenderer.
    java:400)
    at com.sun.rave.web.ui.renderer.TableRenderer.encodeBegin(TableRenderer.
    java:123)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.jav
    a:683)

    I've dug deeper into this problem and am able reproduce the error in the Pluto server. To reproduce this error, I modified my Oracle jdbc driver from the JSC embedded driver (smoracle.jar) to the Oracle native driver (ojdbc14.jar). Now, I am getting the exception in my Sun Application Server:
    What is the difference between ojdbc14.jar and smoracle.jar that could cause this problem? What can I do so that I can fix this problem for ojdbc14.jar?
    Thanks,
    Marc
    P.S.
    The problem is with the clob column (DOR_NOTE_TX). The stack trace is:
    [#|2007-02-06T09:00:53.663-0800|INFO|sun-appserver-pe8.2|javax.enterprise.system.stream.out|_ThreadID=16;|
    Reader executing query ps=0 SELECT DOR_NOTE_DT, DOR_NOTE_TX FROM DOR.DOR_NOTE_DATA WHERE DOR_NOTE_CD='SECURITY' AND TO_CHAR(DOR_Note_Dt, 'mm/dd/yyyy') = '02/05/2007'
    No Params|#]
    [#|2007-02-06T09:00:53.679-0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=16;|
    java.sql.SQLException: Invalid precision value. Cannot be less than zero
    Message was edited by:
    marcnikko

  • Getting "Invalid Precision Value" Error

    I am totally stumped and need some help. I am using Java 1.3.1 and have a JDBC-ODBC connection setup to an Access97 database. There is a field in the database table that is an OLEObject and I am using setBytes in a PreparedStatement to set that field.
    I have been given two scenarios: one that succeeds and one that fails.
    For the success case, the length of the byte array is 8158.
    For the failure case, the length of the byte array is 7982. The error I get is:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid precision value
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBinary(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setBinary(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setBytes(Unknown Source)
    Can anyone tell me what boundary I crossed and how I can get around this problem? I need a fix to this very badly.
    Thanks.
    Bill

    You can try out
    setObject() instead of setBytest() ,method of PreparedStatement.
    It worked in my case when I faced similar problem setting
    a string object on Preparedstatement.
    Best of luck
    Sandesh.

  • Unnecessary complication in PRECISION, SCALE implementation in Oracle

    After going through the post
    Shouldn't this CREATE TABLE statement error out?
    I think that PRECISION and SCALE implementation in Oracle is unnecessary complex.
    If you want to store a number like 23.456
    create table john (empid number(5,3));
    Table created.
    INSERT INTO JOHN VALUES (23.456);
    1 row created.In NUMBER(5,3) declaration 5 stands for the total number of digits including the numbers after the decimal point and 3 stands for the digits to right of the decimal point.
    But don't you think the most straightforward way to store 23.456 would be
    create table john (empid number(2,3)); -- 2 for the numbers to the left of the decimal and 3 for the numbers right to the decimal.
    Why didn't Oracle Corporation choose a simpler syntax like i've mentioned?

    Oracle stores all numbers using significand and exponent (in scientific notation), so using this same framework to declare the number of digits of precision is most accurate and flexible.
    Although the use of scientific notation is not common when writing about units of currency, so this usage may seem non-intuitive at first glance.
    Your proposed syntax would cause other problems with very large or small numbers.
    How about a number like 4.567E100?
    This number only requires 4 digits of precision and is perfectly valid in an Oracle database.
    The implementation is explained well in the Concepts Guide and is both simple and elegant.

  • Difference between "precision" "scale"

    Hello!
    Could someone explain the difference between:
    ”javax.persistence.column.precision” and ”javax.persistence.scale”
    when using these in annotations
    I mean, what is the difference between scale and precision? Any example?
    Thanks in advance!

    Thanx for the fast reply!
    So if I have the number : 123456.22334455667
    What would the scale and precision be?
    precision = 11 (=11 digits in '22334455667')
    scale=???

  • BC4J - how to remove invalid Row from ViewObject

    See the simplified code below. I want to insert a number of records in a table in one transaction. For every insert any occuring error is handled (stored) and after all inserts the errors are reported.
    private void insert(ViewObject vo, int id, String flag) {
    try {
    Row row = vo.createRow();
    row.setAttribute("Id", new Integer(id));
    row.setAttribute("Flag", flag);
    vo.insertRow(row);
    appMod.getTransaction().postChanges();
    catch (JboException exc) {
    handleError(exc);
    // appMod.getTransaction().rollback();
    So when inserting 3 records as below:
    insert(vo, 1, "A");
    insert(vo, 2 ,"BB");
    insert(vo, 3, "C");
    a "JBO-27010: Attribute set with value BB for Flag in Testtab has invalid precision/scale" exception will occur in the second record on the statement row.setAttribute("Flag", flag); as the Flag attribute is a varchar2(1). When the 3rd record gets inserted still an error occurs. It seems that the 2nd record is still cached somewhere; it's not been inserted into the ViewObject (from using the debugger I get the impression it's in the Entity object cache). BC4J tries to insert the 2nd row, that only has an Id attribute and no Flag attribute which is defined not null. So the 3rd record which is ok doesn't get inserted....
    How can I get rid of the second row ? Doing a rollback when an exception occurs doesn't work because then the first record which is ok is lost.
    Cheers Hans

    It turns out to be pretty simple - row.remove() does the trick.
    If only I'ld look in the right place first time everytime... :P

  • Text input control the length

    Hey,
    I have a text input field with 240 length (displayed in 3 rows).
    when users enters more than this length it stops the user but when he copies from some where else
    and pastes the text here it does not stop the user to the size. (he can copy more than 240 size).
    - is there a way we can provide a counter when he types or copies here
    - how do we stop him when he copies more than 240 size (copying using right click mouse and paste OR ctrl-V)
    Thanks

    Hi,
    I tried the javascript. It prevants the user to paste. But the need is to allow the user to do the right-click paste but not beyond the allowed size.
    Also,
    when I get the error message it shows the DB length constraint message EVEN THOUGH I have added a validation for length with error message ("Length cannot be more then 60") in the attribute.
    Error: Attribute set with value 123456701234567890123456789012345678901234567890123 456789012123456701 2345678901234567890123456789012345678901234567890 for Note in AppModule.EmpView has invalid precision/scale
    Attribute set with value 1234567012345678901234567890123456789012345678901234567890121234567012345678901234567890123456789012345678901234567890 for Note in AppModule.EmpView has invalid precision/scale
    How can I show my message and suppress the above default message?
    Also the message shows up twice?
    Thanks

  • How can I use jbo:InputSelect for a char type filed?

    How can I use <jbo:InputSelect for a char type filed?
    I have two tables. One is room (primary key is room(type is char)), another table is responsibility (foreign ker is room(type is char)). Both tables have same length for room column.
    There is a problem:
    If I use (in the "DataEditComponent.jsp" file)
    <jbo:InputSelect multiple="false" datasource="dsEdit" displaydatasource="roomData" displaydataitem="ROOM" displayvaluedataitem="ROOM" ></jbo:InputSelect>
    to get the room input for responsibility from combobox(Datasource roomData is from room table). In the form the room field cannot bind the data in combobox, alway select the first item. And if I select one item and click the update button.There is an error message:
    Error Message: JBO-27010: Attribute set with value H409 for Room in Responsibility has invalid precision/scale
    I found If I changed the field type from char to varchar2 in database also change the entity objects, it works well. I wonder if there are any diffrence using <jbo:InputSelect tag in char and varchar2 type. How can I use <jbo:InputSelect for a char type filed as i don't want to change my datatype in database at this stage.
    I try this in JDeveloper 9.03, 9.034, 9.04. The result is the same.

    If I were in your shoes, here's how I would do it:
    <%-- Assuming you have dsRoom and dsResponsibility --%>
    <%-- Select is an HTML tag --%>
    <select name="ROOM" size="1">
    <% char roomID =""; // Init your character var
    // Open a rowsetIterator to get the records and add them to the LOV
    <jbo:RowsetIterate datasource="dsResponsibility" changecurrentrow="true" >
    <% roomID = (char)dsResponsibility.getRowSet().getCurrentRow().getAttribute("ROOM"); // Grab the char value
    // add the value to the LOV
    %>
    <option value="<%=roomID%>"><%=roomID%></option>
    </jbo:RowsetIterate>
    </select>
    If you are using this as part of an edit page you may want to utilize the "selected" option of the <option> tag. In one instance I am doing this on an edit page because the use may open an existing record. If I don't account for it, then it will change the DB to contain the first value from the list! You can do a simple check like:
    //Set the current record's char
    char curRecord = (char)rowEdit.getAttribute("ROOM");
    // inside the iterate:
    if (curRecord == roomID) {
    <option value="<%=roomID%>" selected><%=roomID%></option>
    } else {
    <option value="<%=roomID%>" ><%=roomID%></option>
    Hope that helps!

  • Error while setting data into table

    I am getting an error while inerting a new record into table
    error is
    JBO-27010: Attribute set with value 9991431 for AckmntInd in EdMsgHeaderDetailsEO has invalid precision/scale oracle.jbo.AttrSetValException: JBO-27010: Attribute set with value 9991431 for AckmntInd in EdMsgHeaderDetailsEO has invalid
    and followed by
    java.lang.ArrayIndexOutOfBoundsException: 20 at oracle.jbo.server.ViewRowStorage.getViewAttributeDef
    help to fix this error is appreciated !!
    thanks,
    Message was edited by:
    user447047
    Message was edited by:
    user447047

    As you have mentioned following error...
    JBO-27010: Attribute set with value 9991431 for AckmntInd in EdMsgHeaderDetailsEO has invalid precision/scale oracle.jbo.AttrSetValException:
    It comes when you are trying to insert a value to an attribute whose DB width is less then the value supplied.
    For example If corresponding value of Number(2) is 123, then JBO-27010 will be thrown.
    Change it in either place.
    Atal

  • HOWTO: Using a BC4J Application Module in an Stateless EJB Session Bean

    HOWTO: Using a BC4J Application Module in an Stateless EJB Session Bean
    by Steve Muench
    Overview
    BC4J provides automatic facilities for deploying any application module as a stateful EJB session bean. If you want to leverage the features of your BC4J application module from a stateless EJB session bean, it's not automatic but it is straightforward to implement. This howto article explains the details.
    For our example, we will create a stateless EJB session bean that uses a container-managed transaction. To keep things simple, let's assume the session bean has a single public method on its remote interface named createDepartment() with the following signature:
    public void createDepartment(int id, String name, String loc) throws AppException
    AppException is an example of an application-specific exception that our method will throw if any problems arise during its execution.The goal of this article is to illustrate how to use the BC4J application module named com.example.hr.HRApp as part of the implementation of this createDepartment method on our stateless enterprise bean. Let's assume that the HRApp application module has a view object member named Departments, based on the com.example.hr.DeptView view object, based on the familiar DEPT table and related to the com.example.hr.Dept entity object so our view can be updateable.
    Creating the Stateless Session Bean
    We can start by using the JDeveloper Enterprise Bean wizard to create a new stateless session bean called StatelessSampleEJB implemented by:[list][*]com.example.StatelessSampleEJBBean (Bean class)[*]com.example.StatelessSampleEJBHome (Home interface)[*]com.example.StatelessSampleEJB (Remote interface)[list]
    We then use the EJB Class Editor to add the createDepartment method to the remote interface of StatelessSampleEJB with the signature above. We edit the remote interface to make sure that it also reflects that the createDepartment method thows the AppException like this:
    package com.example;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    public interface StatelessSampleEJB extends EJBObject {
      void createDepartment(int id, String name, String loc)
      throws RemoteException,AppException;
    }Before we start adding BC4J into the picture for our implementation, our StatelessSampleEJBBean class looks like this:
    package com.example;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    public class StatelessSampleEJBBean implements SessionBean {
      public void ejbCreate(){}
      public void ejbActivate(){}
      public void ejbPassivate(){}
      public void ejbRemove(){}
      public void setSessionContext(SessionContext ctx){
      public void createDepartment(int id, String name, String loc) 
      throws AppException {
        // TODO: Implement method here
    }We can double-click on the ejb-jar.xml file in our project to see the XML deployment descriptor for the bean we just created:
    <ejb-jar>
       <enterprise-beans>
          <session>
             <description>Session Bean ( Stateless )</description>
             <display-name>StatelessSampleEJB</display-name>
             <ejb-name>StatelessSampleEJB</ejb-name>
             <home>com.example.StatelessSampleEJBHome</home>
             <remote>com.example.StatelessSampleEJB</remote>
             <ejb-class>com.example.StatelessSampleEJBBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
          </session>
       </enterprise-beans>
    </ejb-jar>We need to add the extra <assembly-descriptor> section in this file to indicate that the createDepartment method will require a transaction. After this edit, the ejb-jar.xml file looks like this:
    <ejb-jar>
       <enterprise-beans>
          <session>
             <description>Session Bean ( Stateless )</description>
             <display-name>StatelessSampleEJB</display-name>
             <ejb-name>StatelessSampleEJB</ejb-name>
             <home>com.example.StatelessSampleEJBHome</home>
             <remote>com.example.StatelessSampleEJB</remote>
             <ejb-class>com.example.StatelessSampleEJBBean</ejb-class>
             <session-type>Stateless</session-type>
             <transaction-type>Container</transaction-type>
          </session>
       </enterprise-beans>
       <assembly-descriptor>
          <container-transaction>
             <method>
                <ejb-name>StatelessSampleEJB</ejb-name>
                <method-name>createDepartment</method-name>
                <method-params>
                   <method-param>int</method-param>
                   <method-param>java.lang.String</method-param>
                   <method-param>java.lang.String</method-param>
                </method-params>
             </method>
             <trans-attribute>Required</trans-attribute>
          </container-transaction>
       </assembly-descriptor>
    </ejb-jar>
    Aggregating a BC4J Application Module
    With the EJB aspects of our bean setup, we can proceed to implementing the BC4J application module aggregation.
    The first thing we do is add private variables to hold the EJB SessionContext and the instance of the aggregated BC4J ApplicationModule, like this:
    // Place to hold onto the aggregated appmodule instance
    transient private ApplicationModule _am  = null;
    // Remember the SessionContext that the EJB container provides us
    private           SessionContext    _ctx = null;and we modify the default, empty implementation of the setSessionContext() method to remember the session context like this:
    public void setSessionContext(SessionContext ctx){ _ctx = ctx; }We add additional constants that hold the names of the J2EE datasource that we want BC4J to use, as well as the fully-qualified name of the BC4J application module that we'll be aggregating:
    // JNDI resource name for the J2EE datasource to use
    private static final String DATASOURCE = "jdbc/OracleCoreDS";
    // Fully-qualified BC4J application module name to aggregate
    private static final String APPMODNAME = "com.example.hr.HRApp";We expand the now-empty ejbCreate() and ejbRemove() methods to create and destory the aggregated instance of the BC4J application module that we'll use for the lifetime of the stateless session bean. When we're done, ejbCreate() it looks like this:
    public void ejbCreate() throws CreateException {
      try {
        // Setup a hashtable of environment parameters for JNDI initial context
        Hashtable env = new Hashtable();
        env.put(JboContext.INITIAL_CONTEXT_FACTORY,JboContext.JBO_CONTEXT_FACTORY);
        // NOTE: we want to use the BC4J app module in local mode as a simple Java class!
        env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
        env.put(PropertyConstants.INTERNAL_CONNECTION_PARAMS,DATASOURCE);
        // Create an initial context, using this hashtable of environment params
        InitialContext ic = new InitialContext(env);
        // Lookup a home interface for the application module
        ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(APPMODNAME);
        // Using the home, create the instance of the appmodule we'll use
        _am = home.create();
        // Register the BC4J factory to handle EJB container-managed transactions
        registerContainerManagedTransactionHandlerFactory();
      catch(Exception ex) {
         ex.printStackTrace();
        throw new CreateException(ex.getMessage());
    }and ejbRemove() looks like this:
    public void ejbRemove() {
      try {
        // Cleanup any appmodule resources before getting shutdown
        _am.remove();
      catch(JboException ex) { /* Ignore */ }
    }The helper method named reigsterContainerManagedTransactionHandlerFactory() looks like this:
    private void registerContainerManagedTransactionHandlerFactory() {
      SessionImpl session = (SessionImpl)_am.getSession();
      session.setTransactionHandlerFactory(
        new TransactionHandlerFactory() {
          public TransactionHandler  createTransactionHandler() {
            return new ContainerManagedTxnHandlerImpl();
          public JTATransactionHandler createJTATransactionHandler() {
            return new ContainerManagedTxnHandlerImpl();
    }The last detail is to use the BC4J appmodule to implement the createDepartment() method. It ends up looking like this:
    public void createDepartment(int id, String name, String loc)
    throws AppException {
      try {
        // Connect the AM to the datasource we want to use for the duration
        // of this single method call.
        _am.getTransaction().connectToDataSource(null,DATASOURCE,false);
        // Use the "Departments" view object member of this AM
        ViewObject departments = _am.findViewObject("Departments");
        // Create a new row in this view object.
        Row newDept = departments.createRow();
        // Populate the attributes from the parameter arguments.
        newDept.setAttribute("Deptno", new Number(id));
        newDept.setAttribute("Dname", name);
        newDept.setAttribute("Loc", loc);
        // Add the new row to the view object's default rowset
        departments.insertRow(newDept);
        // Post all changes in the AM, but we don't commit them. The EJB
        // container managed transaction handles the commit.
        _am.getTransaction().postChanges();
      catch(JboException ex) {
        // To be good EJB Container-Managed Transaction "citizens" we have
        // to mark the transaction as needing a rollback if there are problems
        _ctx.setRollbackOnly();
        throw new AppException("Error creating dept "+ id +"\n"+ex.getMessage());
      finally {
        try {
          // Disconnect the AM from the datasource we're using
          _am.getTransaction().disconnect();
        catch(Exception ex) { /* Ignore */ }
    Building a Test Client
    With the EJB-Tier work done, we can build a sample client program to test this new stateless EJB Session Bean by selecting the bean in the Oracle9i JDeveloper IDE and choosing "Create Sample Java Client" from the right-mouse menu.
    When the "Sample EJB Client Details" dialog appears, we take the defaults of connecting to embedded OC4J container. Clicking the (OK) button generates the following test class:
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.example.StatelessSampleEJB;
    import com.example.StatelessSampleEJBHome;
    public class SampleStatelessSampleEJBClient {
      public static void main(String [] args) {
        SampleStatelessSampleEJBClient sampleStatelessSampleEJBClient =
           new SampleStatelessSampleEJBClient();
        try {
          Hashtable env = new Hashtable();
          env.put(Context.INITIAL_CONTEXT_FACTORY,
                  "com.evermind.server.rmi.RMIInitialContextFactory");
          env.put(Context.SECURITY_PRINCIPAL, "admin");
          env.put(Context.SECURITY_CREDENTIALS, "welcome");
          env.put(Context.PROVIDER_URL,
                  "ormi://localhost:23891/current-workspace-app");
          Context ctx = new InitialContext(env);
          StatelessSampleEJBHome statelessSampleEJBHome =
               (StatelessSampleEJBHome)ctx.lookup("StatelessSampleEJB");
          StatelessSampleEJB statelessSampleEJB;
          // Use one of the create() methods below to create a new instance
          // statelessSampleEJB = statelessSampleEJBHome.create();
          // Call any of the Remote methods below to access the EJB
          // statelessSampleEJB.createDepartment( int id, java.lang.String name, java.lang.String loc );
        catch(Throwable ex) {
          ex.printStackTrace();
    }We uncomment the call to the create() method and add a few calls to the createDepartment() method so that the body of the test program now looks like this:
    // Use one of the create() methods below to create a new instance
    statelessSampleEJB = statelessSampleEJBHome.create();
    // Call any of the Remote methods below to access the EJB
    statelessSampleEJB.createDepartment( 13, "Test1","Loc1");
    System.out.println("Created department 13");
    statelessSampleEJB.createDepartment( 14, "Test2","Loc2");
    System.out.println("Created department 14");
    try {
      // Try setting a department id that is too large!
      statelessSampleEJB.createDepartment( 23456, "Test3","Loc3");
    catch (AppException ax) {
      System.err.println("AppException: "+ax.getMessage());
    }Before we can successfully run our SampleStatelessSampleEJBClient we need to first run the EJB bean that the client will try to connect to. Since Oracle9i JDeveloper supports local running and debugging of the EJB-Tier without doing through a full J2EE deployment step, to accomplish this prerequisite step we just need to right-mouse on the StatelessSampleEJB node in the System Navigator and select "Run". This starts up the embedded OC4J instance and runs the EJB right out of the current out path.Finally, we can run the SampleStatelessSampleEJBClient, and see the output of the test program in the JDeveloper log window:
    Created department 13
    Created department 14
    AppException: Error creating dept 23456
    JBO-27010: Attribute set with value 23456 for Deptno in Dept has invalid precision/scale
    Troubleshooting
    One error that might arise while running the example is that the database connection information in your data-sources.xml for the jdbc/OracleCoreDS datasource does not correspond to the database you are trying to test against. If this happens, then double-check the file .\jdev\system\oc4j-config\data-sources.xml under the JDeveloper installation home directory to make sure that the url value provided is what you expect. For example, to work against a local Oracle database running on your current machine, listening on port 1521, with SID of ORCL, you would edit this file to have an entry like this for jdbc/OracleCoreDS :
    <data-source
        class="com.evermind.sql.DriverManagerDataSource"
        name="OracleDS"
        location="jdbc/OracleCoreDS"
        xa-location="jdbc/xa/OracleXADS"
        ejb-location="jdbc/OracleDS"
        connection-driver="oracle.jdbc.driver.OracleDriver"
        username="scott"
        password="tiger"
        url="jdbc:oracle:thin:@localhost:1521:ORCL"
        inactivity-timeout="30"
    />This is the data-sources.xml file that gets used by the embedded OC4J instance running in JDeveloper.
    Conclusion
    Hopefully this article has illustrated that it is straightforward to utilize the full power of BC4J in local mode as part of your EJB Stateless Session Beans using container-managed transaction. This example illustrated a single createDepartment method in the enterprise bean, but by replicating the application module interaction code that we've illustrated in createDepartment, any number of methods in your stateless session bean can use the aggregated application module instance created in the ejbCreate() method.
    Code Listing
    The full code listing for the SampleStatelessEJB bean implementation class looks like this:
    * StatelessSampleEJB
    * Illustrates how to use an aggregated BC4J application module
    * in local mode as part of the implementation of a stateless
    * EJB session bean using container-managed transaction.
    * HISTORY
    * smuench/dmutreja 14-FEB-2002 Created
    package com.example;
    import oracle.jbo.*;
    import oracle.jbo.server.*;
    import javax.ejb.*;
    import oracle.jbo.domain.Number;
    import oracle.jbo.common.PropertyConstants;
    import java.util.Hashtable;
    import javax.naming.InitialContext;
    import oracle.jbo.server.ejb.ContainerManagedTxnHandlerImpl;
    public class StatelessSampleEJBBean implements SessionBean {
      // JNDI resource name for the J2EE datasource to use
      private static final String DATASOURCE = "jdbc/OracleCoreDS";
      // Fully-qualified BC4J application module name to aggregate
      private static final String APPMODNAME = "com.example.hr.HRApp";
      // Place to hold onto the aggregated appmodule instance
      transient private ApplicationModule _am  = null;
      // Remember the SessionContext that the EJB container provides us
      private           SessionContext    _ctx = null;
      public void ejbCreate() throws CreateException {
        try {
          // Setup a hashtable of environment parameters for JNDI initial context
          Hashtable env = new Hashtable();
          env.put(JboContext.INITIAL_CONTEXT_FACTORY,JboContext.JBO_CONTEXT_FACTORY);
          env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);
          env.put(PropertyConstants.INTERNAL_CONNECTION_PARAMS,DATASOURCE);
          // Create an initial context, using this hashtable of environment params
          InitialContext ic = new InitialContext(env);
          // Lookup a home interface for the application module
          ApplicationModuleHome home = (ApplicationModuleHome)ic.lookup(APPMODNAME);
          // Using the home, create the instance of the appmodule we'll use
          _am = home.create();
          // Register the BC4J factory to handle EJB container-managed transactions
          registerContainerManagedTransactionHandlerFactory();
        catch(Exception ex) {
           ex.printStackTrace();
          throw new CreateException(ex.getMessage());
      public void ejbActivate(){}
      public void ejbPassivate(){}
      public void ejbRemove(){}
      public void setSessionContext(SessionContext ctx){ _ctx = ctx; }
      public void createDepartment(int id, String name, String loc)
      throws AppException {
        try {
          // Connect the AM to the datasource we want to use for the duration
          // of this single method call.
          _am.getTransaction().connectToDataSource(null,DATASOURCE,false);
          // Use the "Departments" view object member of this AM
          ViewObject departments = _am.findViewObject("Departments");
          // Create a new row in this view object.
          Row newDept = departments.createRow();
          // Populate the attributes from the parameter arguments.
          newDept.setAttribute("Deptno", new Number(id));
          newDept.setAttribute("Dname", name);
          newDept.setAttribute("Loc", loc);
          // Add the new row to the view object's default rowset
          departments.insertRow(newDept);
          // Post all changes in the AM, but we don't commit them. The EJB
          // container managed transaction handles the commit.
          _am.getTransaction().postChanges();
        catch(JboException ex) {
          // To be good EJB Container-Managed Transaction "citizens" we have
          // to mark the transaction as needing a rollback if there are problems
          _ctx.setRollbackOnly();
          throw new AppException("Error creating dept "+ id +\n"+ex.getMessage());
        finally {
          try {
            // Disconnect the AM from the datasource we're using
            _am.getTransaction().disconnect();
          catch(Exception ex) { /* Ignore */ }
      private void registerContainerManagedTransactionHandlerFactory() {
        SessionImpl session = (SessionImpl)_am.getSession();
        session.setTransactionHandlerFactory(
          new TransactionHandlerFactory() {
            public TransactionHandler createTransactionHandler() {
              return new ContainerManagedTxnHandlerImpl();
            public JTATransactionHandler createJTATransactionHandler() {
              return new ContainerManagedTxnHandlerImpl();

    Hi Steve, It4s me again;
    About the question I made, I tried with a single assembly-descriptor tag and a single container-transaction tag in the deployment descriptor of the session bean and these were the results.
    java.lang.NullPointerException
         void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
         java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
         void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
    Then I tried with multiple assembly-descriptor tags each with a single container-transaction tag and the results were:
    java.lang.NullPointerException
         void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
         java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
         void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
    Finally I tried with a single assembly-descriptor and multiple container tags and the results were:
    java.lang.NullPointerException
         void com.evermind.server.rmi.RMIConnection.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(java.lang.Throwable)
         java.lang.Object com.evermind.server.rmi.RMIConnection.invokeMethod(com.evermind.server.rmi.RMIContext, long, long, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         java.lang.Object com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
         void __Proxy1.modificaEnvoltura(java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String)
         void SamplemdeController.envolturaControlEJBClient.main(java.lang.String[])
    How can I make my Stateless Session bean work out?

  • Length Validator

    Hi All,
    I used Length Validator on few attributes in Entity Object. It works fine and gives validation error on UI when validation for textfields fails.
    But, I Do Not want those extra JBO thinggy appearing on UI. How can I get rid of that JBO thiggy (Just "First Name: - FirstName exceeds max limit of 22" looks cool ). How do I suppress JBO thing not to appear. thanks pp
    I have pasted following sample.
    Error
    JBO-27024: Failed to validate a row with key oracle.jbo.Key[[email protected] ] of type GeminiLoginAppModule.TableUsersView
    JBO-27025: Failed to validate attribute FirstName with value dfjkdshfjkdshfjksdhfjkdshfjdshfjdshfjkdhfdsf
    JBO-27025: Failed to validate attribute LastName with value sdfdsfdsfdsfsdfsdhjkfdsjkfhjkdshfjkdshfjkdshfjskdfs
    First Name: - JBO-27010: Attribute set with value dfjkdshfjkdshfjksdhfjkdshfjdshfjdshfjkdhfdsf for FirstName in GeminiLoginAppModule.TableUsersView has invalid precision/scale
    First Name: - FirstName exceeds max limit of 22
    Last Name: - JBO-27010: Attribute set with value sdfdsfdsfdsfsdfsdhjkfdsjkfhjkdshfjkdshfjkdshfjskdfs for LastName in GeminiLoginAppModule.TableUsersView has invalid precision/scale
    Last Name: - LastName exceeds max limit of 22

    Hi,
    didn't try if th SRDemo code also works for validators, I assume this however. Get SRDemo from help--> check for updates
    Expand the UserInterface project and also the node ApplicationSources-->oracle.srdemo.view --> frameworkExt
    The package contains a page lifecycle class that in combination with the other classes intercepts JBO error messages to eliminate the JBO-xxxxx content
    See the faces-config.xml file how this is added
    Frank

  • Error.  Combobox in JTable in 10.1.3 EA

    (oracle.jbo.AttrSetValException) JBO-27010: Attribute set with value oracle.jbo.server.ViewRowImpl@1b for Ediz in AppModule.UgSfpView2 has invalid precision/scale
    Type of "Ediz" is VARCHAR2(5)

    Hi,
    can you provide a step-by-step description using the EMP Table of what you did to get to this state ?
    Frank

Maybe you are looking for