Java.math.BigDecimal and Oracle Number

Creating a Database schema in S1S4U1 from an Oracle database that included fields of Number(10,0), Studio4 used BigDecimals as the datatypes in the abstract schema.
However, when using S1AS7 and CMP EJBs, integer values do not show up as integers in the database . Am I missing some setting somewhere? TIA.

When I use integer values in this field, its stored as a base with an exponent in the database. I changed the fields to java.lang.Long, since I don't need a scale in this field, and even then, integer values are stored as exponential values.
In addition, I'm running into a new problem - the primary key field (also a number (10,0) in the database, but a java.lang.Integer in the EJB, gives the following errors when a Session EJB calls the findByPrimaryKey method on the CMP EJB using the TestApp generated by S1S4:
[11/Feb/2003:15:29:40] INFO ( 869): Bean sdComponents method findByPrimaryKey:
com.sun.jdo.api.persistence.support.JDOUserException: Value: -5,437,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 is less than minimum allowed: -9223372036854775808 for the field type java.lang.Long.
at com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc.assertIsValidLong(FieldDesc.java:608)
at com.sun.jdo.spi.persistence.support.sqlstore.model.FieldDesc.convertValue(FieldDesc.java:416)
Not sure why this is showing up; the schema file in the module clearly says "Decimal"; the field in the EJB clearly says java.lang.Integer; the parameter for the find method says java.lang.Integer. Is the TestApp JSP created by S1S4 doing something to this parameter?

Similar Messages

  • NUMBER - java.math.BigDecimal

    Dear JDBC writer,
    When I have done a query in my Java program on a table in an Oracle database with a NUMBER or NUMBER(4) or NUMBER(4,2) column,
    and I use the generic method ResultSet.getObject(int column), the method always returns a java.math.BigDecimal instance.
    1. In case of NUMBER(4) I had suspected a java.lang.Integer instance. In case of NUMBER I had suspected a java.lang.Double instance. Why did you return a java.math.BigDecimal instance?
    2. Was it your intention to do further calculations with the BigDecimal instance or should I check the precision and scale of the column and get the int or double out of the BigDecimal instance?

    Thanks for the tip about getNUMBER, that may help with some of my other problems, but I'm trying to get data out of oracle spatial geometry types, and both integers and floats are stored in arrays of numbers. If you do a getarray on these or even process them as a result set, you get bigdecimals. How could I do the equivalent of getNUMBER for an array type? This is a huge performance problem for Oracle spatial and java.

  • ADF Mobile : Could not find property inputvalue in class java.math.BigDecimal

    I tried to add an input text item to the list view like below and received an error message while navigating out of the input text field.
    "Could not find property inputvalue in class java.math.BigDecimal".
    Can someone show me some pointers about what is wrong with the below code.
    JDEV Version : 11.1.2.4
    <amx:listView var="row" value="#{bindings.Empdtls.collectionModel}"
                            fetchSize="#{bindings.Empdtls.rangeSize}" styleClass="adfmf-listView-insetList"
                            id="lv1" editMode="true">
                <amx:listItem id="li1">
                  <amx:tableLayout width="100%" id="tl1">
                    <amx:rowLayout id="rl1">
                      <amx:cellFormat width="10px" id="cf3"/>
                      <amx:cellFormat width="60%" height="43px" id="cf2">
                        <amx:outputText value="#{row.ClassCode}" id="ot3"/>
                      </amx:cellFormat>
                      <amx:cellFormat width="10px" id="cf4"/>
                      <amx:cellFormat width="40%" halign="end" id="cf1">
                        <amx:inputText value="#{row.bindings.Salary.inputValue}" simple="true" id="it41"/>
                      </amx:cellFormat>
                    </amx:rowLayout>
                  </amx:tableLayout>
                </amx:listItem>
              </amx:listView>

    Hi,
    #{row.bindings.Salary.inputValue) doesn't access a binding in ADF Mobile. Use #{row.Salary} instead.
    Frank

  • Java.math.BigDecimal;

    Hello every one thanks for your time . i am trying to understand about decimal method. example below well explain itself but i m trying to use userInput in decimal & then add the result but cant work out. any one like to give me any good example or explain which ever easy way for you guys
    Thanks in advance.
    import java.math.BigDecimal;
    public class AddTwoBigNumbers{
      public static void main(String[] args) {
        BigDecimal num1, num2;
        num1 = new BigDecimal(50.020);      "      50.020 is fix value here. How i can change with user input method. "
        num2 = new BigDecimal(100.50);
        Sum(num1, num2);
      public static void Sum(BigDecimal val1, BigDecimal val2){
        BigDecimal sum = val1.add(val2);
        System.out.println("Sum of two BigDecimal numbers: "+ sum);
    }  

    Another nice hint might be: you actually can use this args array thingy up there. Start your program like
    java AddTwoBigNumbers 50.02 100.50and access both values via args[0] and args[1] respectively.

  • Cast to a literal (ex. "java.math.BigDecimal")

    I have an array with 2 columns like:
    "java.math.BigDecimal", "2"
    "java.lang.String", "Test 01"
    "java.math.BigDecimal","120"
    "java.math.BigDecimal","148"
    "java.lang.String", "Test 02"
    Is there way to cast the second string to the correct object type, using the first string.
    Something like this:
    ("java.math.BigDecimal")("2")
    ("java.lang.String")("Test 01")
    thanks in advance,
    intovoid

    You could do this by reflection for classes which
    have a contructor which takes an single string
    parameter - which I believe all these classes do.
    Lot's of messy expections to field. The sequence
    would be something like:
    private static Object create(String[] columns) throws
    Exception {
    Class clazz = Class.forName(columns[0]);  // get
    the class
    Contstructor cons = clazz.getConstructor(new
    Class[]{String.class}); // get constructor from
    String
    return cons.newInstance(new Object[]{columns[1]});
    // construct object
    code]Except, the problem remains that the OP can still not cast the Object returned by newInstance() by using the String in columns[0] (even though the Object is a BigDecimal). Even if it could be cast "dynamically", what would it be cast into - you can not dynamically declare the variable type.
    The above method could work if all the possible objects returned implemented a common interface. Or maybe instanceof could be used to hard-code the cast to the possible objects.
    In the end, I think this type of code can lead to a brittle design.

  • Adding two java.math.BigDecimal values

    Hi,
    I want to add two java.math.BigDecimal values (like a + b).
    This code returns only the a value
    java.math.BigDecimal a = new java.math.BigDecimal(0);
    java.math.BigDecimal a = new java.math.BigDecimal(23);
    a.add(b);How can I add these values?
    Thanks
    Jonny

    For your kind information, the code does not return any value. You are supposed to save the return value from the add() function call. Something like this:
    java.math.BigDecimal c = a.add(b);
    // print the value of c here

  • Excel Export - java.lang.NoSuchMethodError: java.math.BigDecimal

    Hi All,
    I am working on the Excel Export example.
    When I am running the application I am getting the foll. error
    java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
        at com.sap.tut.wd.tutwd_table.tablecomp.TableComp.getProductsTOTAL_PER_ARTICLE(TableComp.java:227)
        at com.sap.tut.wd.tutwd_table.tablecomp.wdp.InternalTableComp.getProductsTOTAL_PER_ARTICLE(InternalTableComp.java:176)
        at com.sap.tut.wd.tutwd_table.tablecomp.wdp.IPublicTableComp$IProductsElement.wdGetObject(IPublicTableComp.java:437)
        at com.sap.tc.webdynpro.progmodel.context.MappedNodeElement.wdGetObject(MappedNodeElement.java:351)
        at com.sap.tc.webdynpro.progmodel.context.AttributePointer.getObject(AttributePointer.java:158)
    Please provide some inputs as how to resolve this problem.
    Regards
    Nikhil Bansal

    Hi Valery,
    I am unable to install anything on my machine due to certain issues. So I shall not be able to implement the solution which you have suggested.
    I have a diff. approach to solve this problem. My intention is to just export some data to excel.
    So I have created a Component (ParentComp) in my application.The view in this comp contains a button Export to Excel 2003. There is an Action associated with this button.
    I have another component ChildComp.
    What I want to do is just call the Interface Controller of ChildComp from the Action ExportToExcel2003.
    I am not passing any data to the ChildComp.Instead I shall be hardcoding some table data in ChildComp itself.
    Please let me know if you are aware of some solution.
    Regards
    Nikhil Bansal

  • Java.math.BigDecimal Problem!

    Hi all,
    I'm running a webdynpro application, inside it I'm executing a RFC that receives some parameters. Most of them are strings, but just one of them is BigDecimal type. When I run the app, I got the following error...
    java.lang.NullPointerException
    at java.math.BigDecimal.<init>(BigDecimal.java:181)
    I appreciate any help you can give me.
    Thanks in advance.
    Jesus.

    Hi Nibu,
    Here you have the code that I'm using..
    BigDecimal imp = new BigDecimal (
    wdContext.currentContextElement().getImporte());
    wdThis.wdGetVR_ControllerController.executeRFC(imp);
    Then in the VR_Controller, I have created a method call executeRFC like this...
    public void executeRFC (java.math.BigDecimal importe)
    try {
    wdContext.currentZbapi_createVR_InputElement().modelObject.setImp(importe);
    wdContext.currentZbapi_createVR_InputElement().modelObject.execute(),
    catch (Exception e) {
    Thanks.
    Jesus.

  • Problem with java.sql.Clob and oracle.sql.CLOB

    Hi,
    I am using oracle9i and SAP web application server. I am getClob method and storing that in java.sql.Clob and using the getClass().getName() I am getting the class name as oracle.sql.CLOB. But when I am trying to cast this to oracle.sql.CLOB i am getting ClassCastException. The code is given below
    java.sql.Clob lOracleClob = lResultSet.getClob(lColIndex + 1);
    lPrintWriter = new PrintWriter(new BufferedWriter (((oracle.sql.CLOB) lOracleClob).getCharacterOutputStream()));
    lResourceStatus = true;
    can anybody please tell me the what is the problem with this and solution.
    thanks,
    Ashok.

    Hi Ashok
    You can get a "ClassCastException" when the JVM doesn't have access to the specific class (in your case, "oracle.sql.CLOB").
    Just check your classpath and see if you are referring to the correct jar files.
    cheers
    Sameer
    PS: Please award points if you find the answer useful

  • Java application (tomcat) and Oracle RAC 10gR2

    Hi, I have an Oracle RAC 10gR2 (10.2.0.3) on Suse Linux Enterprise Server (3 nodes).
    I have several application running on tomcat 5.X and tomcat 6.X with java 1.5 and java 1.6. Sometimes, because of hardware fail, network problems,... one of the nodes fails, and then the other 2 nodes still working and my database is up. However, the most of applications lose the connection with the database, and I must to restart the tomcat. I want to have a system more reliable and robust, and I want to prepare the tomcat's and java application for prevent it. I have read the http://drdobbs.com/java/222700353?pgno=1 and http://db360.blogspot.com/2007/01/is-your-java-application-failoverproof.html. I've been tried the example of the first url, but I don't connect with my database. However, I've probe the sample on another oracle rac (10.2.0.4) and it works. In the samples, it use the ucp.jar (11g) and ons.jar (10g) and ojdbc6.jar (11g driver).
    Anyone can help me how can I configure my application for I must not to restart the tomcats??
    Thanks you very much!!.

    The best solution for your problem is ORACLE SUPPORT.. Please raise an SR and coordinate with them.. GoodLuck!

  • Java Stored Procedures and Oracle XE

    Hi folks,
    Does anyone know if Oracle XE supports Java Stored Procedures.
    Thanks in advance,
    Kris

    Unfortunately you misunderstood me. I didn't call Oracle XE crippled, Yes, I did misunderstand. Apologies.
    Bottom line - JMS is not extant. JMS and AQ are not quite the same thing.
    AQ was developed back in early Oracle8 (8.0) (and possibly the late Oracle 7) days and seems to have been a pure PL/SQL implementation (probably with hooks at the C/C++ DB kernel level). The extensions that link to JMS came later.
    Since JMS depends on Java, and since 'Java in the database' is not part of XE by design and well documented, I considered you comment
    that JMS is not supported at all in Oracle XE or is at least
    severly crippled.to be more than you apparently meant it to be,
    AQ is 'supported' but lack of Java Stored Procs causes some limitations here as you have noted, as well as in Oracle Text and interMedia support.
    I'd love to see Java in the database for future upgrades to XE.

  • JAVA WEB SERVICE AND ORACLE DATABASE

    Hi,
    I working with Oracle database 10g, Oracle Bpel 10.1.2.0 and JDeveloper 10g on windows xp home.
    I have created a java class with incapsulated sql statement (jdbc protocol).
    All it's ok when the class runs from command line (JCreator).
    After that i created the web service from java classes (with JDeveloper) and I connected (with success) database to OC4J and run the web service, i have this xml message like result:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <SOAP-ENV:Body>
    - <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server.Exception:</faultcode>
    <faultstring>java.lang.NullPointerException</faultstring>
    <faultactor>/DipendentiWebService/DipendentiWebService</faultactor>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Which's my error?
    Thanks

    Hi Frank,
    thank you for the reply, but i don't undertsand what do you mean "add print statement to java class".
    follows the java class code that loads a mail address from database oracle:
    import sqlj.runtime.*;
    import sqlj.runtime.ref.*;
    import java.sql.SQLException;
    import java.util.*;
    import java.sql.*;
    import utility.*;
    import java.lang.*;
    import java.io.*;
    public class DipendentiWS{
    protected static String matricola = null;
    protected static String email = null;
    private static DBConnectionManager connMgr;
    private static Connection conn = null;
    private static Statement st = null;
    private static PreparedStatement pstmt;
    private static ResultSet rs = null;
    private static final String FIND_BY_MATRICOLA = "SELECT Email FROM ARDIP.DIPENDENTI " +
                                                           "WHERE Matricola = ?";
    // metodo ausiliario per il rilascio delle risorse
    * @webmethod
         public static String leggiMail(String matricola)throws SQLException{
         // Caricamento dati Dipendente da DB
         try {
    connMgr = DBConnectionManager.getInstance();
         Connection conn = connMgr.getConnection("access");
    if (conn != null) {
         conn.setAutoCommit(false);
    st = conn.createStatement();
    pstmt = conn.prepareStatement(FIND_BY_MATRICOLA);
                   pstmt.setString(1, matricola);
                   rs = pstmt.executeQuery();
    if (rs.next()) {
    email =rs.getString(1);
    conn.commit();
    // conn.setAutoCommit(true);
    catch(SQLException e){
         e.printStackTrace();
         System.err.println("ATTENZIONE!!!!");
              finally {
         try {st.close();}
         catch(SQLException ex){ ex.printStackTrace();}
              return email;      
         }

  • How to open-up a pdf file to a particular page via java? (file and page number from another program)

    I have created an Access 2003 Form. Data is entered. The data can be viewed once entered in the same form format, with one addition. The addition is a link to another program where we store files. The files stored are pdf documents. Each document is a scanned file (500+ pages). The link can open-up the pdf file. I want the link to open-up the pdf file to a particular page. I will supply the page number from the database.
    I am aware of Adobe Acrobat 7.0 PDF Open Parameters using a URL that specifies the file to be opened plus actions to be performed once the file is openend (i.e. http://example.org/doc.pdf#page=3). However, the 3rd party program transfers a file from a server to the client via java. The file does not go via a web browser. The java code transfer the file directly from the file server to the the client.
    Any idea how to accomplish the task of viewing a particular page with the process flow described?
    I am using Adobe Acrobat 7.0 Professional.

    So you are reading this file in a standalone version of Acrobat? If so then use the PDF Open Parameters /a option via the command line.
    Sabian
    Example:
    C:\Program Files\Adobe\Acrobat 7.0\Acrobat>Acrobat.exe /A "zoom=1000=OpenActions" "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\SimpleSubmit.pdf"
    Where:
    Path to Acrobat: C:\Program Files\Adobe\Acrobat 7.0\Acrobat>Acrobat.exe
    Note: The example starts in the Acrobat application directory
    Switch: /A
    Parameter Syntax: "zoom=1000=OpenActions"
    Path to file: "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\SimpleSubmit.pdf"
    Note: The quotes are very important for the syntax to work appropriately.

  • Java Stored Proc and Oracle 8.0.6.20?

    Hi,
    I have a customer using Oracle 8.0.6 (on multi-platforms). We'll need to implement a pl/sql which needs to execute an external script.
    My understanding is there are only 2 ways to achieve this: (a) use Java stored procedure, (b) use C/C++ library
    Question 1: Is Java Stored Proc available in 8.0.6?
    Question 2: Is there anywhere I can download Oracle 8.0.6 (Windows, or Tru64, Linux)?
    - Will

    java in the database was introduced from Oracle8i onwards. this version of Oracle does not support java virtual machine in the database.
    You would need to use C/C++ external procedures.

  • Incompatable types:java.lang.String and phone number[]

    i am trying to run a search of an array but i can not get the Class to compile.
    The code is below:
    public class People
    private int numberSize;
    private PhoneNumber[] number;
    public People(int maxNumberSize)
    number = new PhoneNumber[maxNumberSize];
    numberSize = 0;
    public void addAPerson(String personName, String Number)
    PhoneNumber thePerson = new PhoneNumber (personName, Number);
    number[numberSize] = thePerson;
    numberSize++;
    private String findPhoneNumber(String person)
    int location = -1;
    for (int i=0; i<numberSize; i++)
    if (number.getNumber() == number)
    location = i ;

    Hi.
    you're using
    private String findPhoneNumber(String person)
    int location = -1;
    for (int i=0; i<numberSize; i++)
    if (number.getNumber() == number)
    location = i ;
    }Now - your method gets a name of a person, right?
    And you want to find that person's object in the array, and retrieve the phone number.
    Your first problem lies in -
    if (number.getNumber()==number)Can you see the problem? number is an array. You want to check the data of the object in the array's location i, but you're not doing it. So, first, you would change it to read
    if (number.getNumber()==number)
    Now - what are we doing here? You are getting the number of the person in place i in the array, by using the getNumber() method. Then you check if it equals to number.
    It won't be, because number is the array itself. And anyway - you are doing it the other way around, because you want to check if the object in place i in the array has the name that you got previously.
    So, you're looking at something like
    if (number.getName()==person)
    (person is the argument you got on calling the method, remember?)
    ok.
    Now you can go on with the rest.
    Nimo.

Maybe you are looking for