CAN I DO DATA CACHING by JAVA BEAN persistence?

I need to keep Objects cached in the server side. so in order to make it persistence can i use JAVA BEANS.
I am not interested to do for EJB.
I need a cache component build in the server side .
how can i do it in JAVA / J2EE platform?

Your cache doesn't necessarily need to be persistant unless you're doing something like calculating the size or keeping it between server restarts.
A simple cache is very easy to do but can get quite complex very quickly. Search for Caching on javaworld.com there's a pretty good article on it there.
Also take a look for JCache on jcp.org, it's a request for a cacheing spec to be built into Java. Some interesting stuff there.
Basically all you need is a HashMap to hold, keys and objects.

Similar Messages

  • Crystal Reports data connection using Java beans

    Hi
    My name is Bach Ong, i'm currently perform re-configuring Crystal reports 2008 to connect via
    Java bean to Jboss server, this uses look up service on JBoss server. The connection is using Connect
    look up using the properties:
    java.naming.provider.url=jnp://emgsydapp121:10499
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    for file CRConfig.xml i put as follows:
    <JDBCURL></JDBCURL>
    <JDBCClassName></JDBCClassName>
    <JDBCUserName></JDBCUserName>
    <JNDIURL>jnp://emgsydapp121:10499</JNDIURL>
    <JNDIConnectionFactory>org.jnp.interfaces.NamingContextFactor
    y</JNDIConnectionFactory>
    <JNDIInitContext>/</JNDIInitContext>
    <JNDIUserName></JNDIUserName>
    Can you advise us if this step is correct, and is there any
    documentation that can guide us to right direction.
    for Java testing in Eclipse using remote call class it is working suing the following code:
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jnp.interfaces.NamingContextFactory");
            p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             InitialContext ctx = new InitialContext(p);
      Date asAtDate = CrystalUtils.convertToDate("2014-01-01", CrystalUtils.relativeToToday(0), false);
         String asxCode = "BHP";
         ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
         InitialContext context = new InitialContext(p);
         ClosingPricesReportService ejb = (ClosingPricesReportService) context.lookup(ClosingPricesReportService.REMOTE_JNDI);
         ClosingPricesReport report = ejb.createMTMClosingPriceReport(criteria);
         System.out.println(report.getClosingPrices()[0].getClosingPrice());
         testval = report.getClosingPrices()[0].getClosingPrice().toString();
         System.out.println(testval);
    when i run the tes code the results as follow:
    10:49:45,244 DEBUG [SecurityAssociation ] Using ThreadLocal: false
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] constructed
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connecting
    10:49:45,338 DEBUG [MicroSocketClientInvoker ] Creating semaphore with size 50
    10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connected
    10:49:45,369 DEBUG [ClientSocketWrapper ] reset timeout: 0
    10:49:45,650 DEBUG [InvokerRegistry ] removed SocketClientInvoker[709446e4, socket://emgsydapp121:10473] from registry
    10:49:45,650 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] disconnecting ...
    10:49:45,650 DEBUG [SocketWrapper ] ClientSocketWrapper[Socket[addr=/10.137.2.40,port=10473,localport=64150].2cba5bdb] closing
    37.99000000000000198951966012828052043914794921875
    37.99000000000000198951966012828052043914794921875
    Can anyone assist me in convert the above settings to get access by Crystal reports.
    My attemp current are below:
    public class CFDClosingPricesRpt extends CrystalReport {    
        //Constructor
        public CFDClosingPricesRpt(){
            super(ClosingPriceBean.INSTANCE);
         * Returns the ResultSet for this report to Crystal.
         * @param asxCode
         * @param asAtDateString
         * @return
    public ResultSet getNewReport(String asxCode, String asAtDateString) {                     
         try {
             Properties p = new Properties();
             p.put(Context.INITIAL_CONTEXT_FACTORY,
             "org.jnp.interfaces.NamingContextFactory");
             p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
             p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
             //InitialContext ctx = new InitialContext(p);
             clearCachedReportBeans();     
       Date asAtDate = CrystalUtils.convertToDate("2013-01-01", CrystalUtils.relativeToToday(0), false);
          asxCode = "BHP";
          ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
          //ClosingPricesReportService ejb = (ClosingPricesReportService) ctx.lookup(ClosingPricesReportService.REMOTE_JNDI);
          ClosingPricesReportService ejb = (ClosingPricesReportService) ServiceLocator.getInstance().getService(ClosingPricesReportService.REMOTE_JNDI);           
          ClosingPricesReport report = ejb.createClosingPriceReport(criteria);
          // assemble Crystal-friendly DTO
          Collection closingPrices = Arrays.asList(report.getClosingPrices());
          for (Iterator iter = closingPrices.iterator(); iter.hasNext();) {
                    MBLXClosingPrice cp = (MBLXClosingPrice) iter.next();               
                    if (cp==null) continue;               
                    addReportBean(new ClosingPriceBean( report.getSuppliedDate(),
                                cp.getClosingPrice(),
                                cp.getAsxCode()));
      } catch (Throwable x) {     
          saveErrorMessage(x);
      return getAsResultSet();             
    Thanks
    Bach Ong

    Hi Don Thanks for the reply.
    I've was able to connect via Java beans and JNDI. But this one is going the JNDI of JBoss sever, which the JNDI already configure and working for Crystal reports v10.
    Bach

  • Data caching without entity beans

    This may be a basic question :
    We have an app with session beans invoked by MDBs via non-web clients. No Entity Beans.
    I want to cache sql query results in a hashmap. What is the best way to do it?
    Create a pojo singleton with the hashmap and reference that in the session beans?
    Is there any j2ee container consideration in this?
    Is there a better way to do it?
    thanks

    Hi Gilbert,
    Someone recently asked a similar question to yours. Perhaps that thread will
    be helpful to you?
    Author: Valeri Kireitchik
    Subject: how to set exclusive-write-access="true"
    Date: May 17, 2002 10:18 PT
    URL:
    Re: Get the Table name by providing the Sequence name
    The same person (Valeri) also asked his question on two other forums:
    http://www.elephantwalker.com/rfa?id=549
    http://www.mail-archive.com/orion-interest%40orionserver.com/msg19037.html
    Good Luck,
    Avi.

  • Can PJC ORACLE9IAS FORMS Services - FILEUPLOAD Java Bean run on UNIX?

    I got the File Upload Utility sample code from //otn.oracle.com/sample_code/products/forms/content.html
    The File Upload demo consists of the following files:-
    1. fileuploader90.fmb
    2. fileupload90.pll
    3. FileUploader.java, FileUploaderProgrressBar.java ==> By using Oracle 9i JDeveloper(version 9.0.2.822 and java version 1.3.1), I had compiled and deployed and jarred java classes for the client side bean. Finally, I get uploadclient.jar.
    4. FormsDecoder.java, FormsDecoderException.java ==> By using Oracle 9i JDeveloper(version 9.0.2.822 and java version 1.3.1), I had compiled and deployed and jarred java classes for the server side bean. Finally, I get uploadserver.jar.
    And I had done accordingly to the steps.
    I had added an entry in the formsweb.cfg file to call the FileUpload demo as following:-
    [FileUpload]
    pageTitle=Oracle9iAS Forms Services - FileUpload Demo
    archive_jini=f90all.jar,uploadclient.jar
    archive_ie=f90all.jar,uploadclient.jar
    archive=f90all.jar,uploadclient.jar
    form=fileuploader90.fmx
    width=675
    height=480
    separateFrame=false
    splashScreen=no
    lookAndFeel=oracle
    colorScheme=blue
    background=/forms90demo_images/blue.gif
    logo=/forms90demo_images/Forms9i.gif
    envFile=fileupload.env
    And this environment file, fileupload.env, code is as following:-
    #fileupload.env
    #Environment file used to setup the FileUpload Demo
    ORACLE_HOME=/export/home2/9ids/OraHome1
    PATH=/export/home2/9ids/OraHome1/bin/classic:/export/home2/9ids/OraHome1/bin
    CLASSPATH=/export/home2/9ids/OraHome1/forms90/java/uploadserver.jar:/export/home2/9ids/OraHome1/jdk/jre/lib/rt.jar
    FORMS90_PATH=/export/home2/9ids/OraHome1/forms90/demos/lib:/export/home2/9ids/OraHome1/forms90/demos/fileupload/forms
    Then by using Oracle Forms 9.0(version 9.0.2.7.0) attach the FileUpload.pll library and compiled and run the forms.Click on the select button.and NO REPLY.NO ERROR NUMBER.No Progress Bar. Nothing...
    Then I exit the form and add the config=FileUpload& into the web browser. Then I get the forms. Click on the select button and also NO RESPOND,NO ERROR,No Progress Bar. The File Upload Utility is not working.
    Can anyone help me on this issue? Urgent...
    Thank you so much.
    Best Regards,
    Wong

    Hello Duncan,
    Are you one of the authors for the File Upload Utility? I am very happy to talk with you. How can we solve this BIG BUG 2550330? And make it run on UNIX platforms.
    Best Regards,
    Wong

  • Can't transfer date type from java proxy to XI

    I 'm using Java proxy send message to XI&#12290;
    but some element for Date type didn't transfered to XI.
    XI 3.0
    I have tried  notes:719010.

    I have the same exact problem after more than year with no problem... Please help meI didn't install new firmware since I have the player I have the .40 version?thanks

  • Embedding Java bean in Forms 6i

    Hi,
    Can anybody guide me to embed java bean in forms 6i . I need steps to embed. I tried the steps given in oracle site for KnobBean steps are confusing. Can anybody pls help me
    thanks in advance
    Ilam

    Hi
    Following is the result of Jinitiator Java Consol.......
    Oracle JInitiator version 1.1.8.19
    Using JRE version 1.1.8.19
    User home directory = C:\Documents and Settings\Administrator
    JAR caching enabled.
    Cache directory: C:\Program Files\Oracle\JInitiator 1.1.8.19\jcache
    Maximum cache size: 50000000 bytes
    Opening http://202.163.88.194:6777/forms60java/f60all_jinit.jar no proxy
    Loading http://202.163.88.194:6777/forms60java/f60all_jinit.jar from JAR cache.
    Opening http://202.163.88.194:6777/forms60java/java/awt/KeyboardFocusManager.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/forms/engine/MainBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/sun/beans/infos/MainBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/ewt/swing/JBufferedAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/sun/beans/infos/JBufferedAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/ewt/lwAWT/BufferedAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/sun/beans/infos/BufferedAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/ewt/popup/PopupAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/sun/beans/infos/PopupAppletBeanInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/forms/registry/Registry.dat no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/forms/registry/default.dat no proxy
    proxyHost=null
    proxyPort=0
    connectMode=HTTP
    Forms Applet version is : 60821
    Opening http://202.163.88.194:6777/forms60java/oracle/forms/demos/GetClientInfo.class no proxy
    Opening http://202.163.88.194:6777/forms60java/oracle/forms/demos/Utils.class no proxy
    Regards
    Laila Mac

  • Usage of Object Cache for Java in J2EE apps

    Hi,
    we are investigating on whether we can use the Object Cache for Java
    (OCS4J) for our requirements. The question we have come across is:
    What is the designated way of integration for the Object cache to fit
    into the J2EE environment? Unfortunately, although the current manuals
    group OCS4J into the "Oracle Containers for J2EE Services Guide" and the
    suggested package name for the whole thing in JSR 107 seems to be
    javax.util.jcache, there is very little documentation on how the
    designers would like J2EE programmers to use the cache from within a
    J2EE app and all examples given are not from within a J2EE environment.
    We are in particular thinking about a hierarchy of several cache
    "compartments" (Region->Subregion->group) for different topics and using
    the hierarchical name of the cache (region.subregion.group) as the
    primary key for BMP Entity beans, each of them having their own
    CacheAccess object. Then we would have an API of stateless Session beans
    on top of that, which would be determining the cache "compartment", get
    the appropriate Entity Bean with the Cache Access object and then do the
    required operations on the cache.
    But then we immediately run into the question of how the mapping between
    Cache Objects and CacheAccess objects will be done etc.
    So is there anybody that can give us any hints how to use the OCS4J in
    an EJB scenario?
    Thanks in advance for any help!
    Andreas Loew
    [email protected]

    We have Java client requesting over HTTP to application server. We would like to cache some of the objects created by the servlet while serving the request. Can I use the OCS4J for caching the Java objects. Do I require any software or just copying the JAR file and importing the class would serve the purpose?
    Regards
    Arun

  • How to convert csv files into java bean objects?

    Hi,
    I have a CSV file, I want to store the data availabale in that csv file into java bean, I am new to this csv files how can I convert CSV files into java beans.
    Please help me.
    Adavanced Thanks,
    Mahendra

    You can use the java.io API to read (and write) files. Use BufferedReader to read the CSV file line by line. Use String#split() to split each line into an array of parts which were separated by comma (or semicolon). If necessary run some escaping of quotes. Finally collect all parts in a two-dimensional List of Strings or a List of Javabeans.
    java.io API: [http://www.google.com/search?q=java.io+javase+api+site:sun.com]
    java.io tutorial: [http://www.google.com/search?q=java.io+tutorial+site:sun.com]
    Basic CSV parser/formatter example: [http://balusc.blogspot.com/2006/06/parse-csv-upload.html]

  • Livecache data cache usage - table monitor_caches

    Hi Team,
    We have a requirement of capturing the Data cache usage of Livecache on an hourly basis.
    Instead of doing it manually by going into LC10 and copying the data into an excel, is there a table which captures this data on a periodic basis which we can use to get the report at a single shot.
    "monitor_caches" is one table which holds this data, but we are not sure how we can get the data from this table. Also, we need to see the contents of this table, we are not sure how we can do that.
    As "monitor_caches" is a maxdb table I am not sure how I can the data from this table. I have never worked on Maxdb before.
    Has anyone had this requirement.
    Warm Regards,
    Venu

    Hi,
    For Cache usage below tables can be referred
    Data Cache Usage - total (table MONITOR_CACHES)
    Data Cache Usage - OMS Data (table MONITOR_CACHES)
    Data Cache Usage - SQL Data (table MONITOR_CACHES)
    Data Cache Usage - History/Undo (table MONITOR_CACHES)
    Data Cache Usage - OMS History (table MONITOR_CACHES)
    Data Cache Usage - OMS Rollback (table MONITOR_CACHES)
    Out Of Memory Exceptions (table SYSDBA.MONITOR_OMS)
    OMS Terminations (table SYSDBA.MONITOR_OMS)
    Heap Usage (table OMS_HEAP_STATISTICS)
    Heap Usage in KB (table OMS_HEAP_STATISTICS)
    Maximum Heap Usage in KB (table ALLOCATORSTATISTICS)
    System Heap in KB (table ALLOCATORSTATISTICS)
    Parameter OMS_HEAP_LIMIT (KB) (dbmrfc command param_getvalue OMS_HEAP_LIMIT)
    For reporting purpose , look into the following BW extractors and develop BW report.
    /SAPAPO/BWEXDSRC APO -> BW: Data Source - Extractor
    /SAPAPO/BWEXTRAC APO -> BW: Extractors for Transactional Data
    /SAPAPO/BWEXTRFM APO -> BW: Formula to Calculate a Key Figure
    /SAPAPO/BWEXTRIN APO -> BW: Dependent Extractors
    /SAPAPO/BWEXTRMP APO -> BW: Mapping Extractor Structure Field
    Hope this helps.
    Regards,
    Deepak Kori

  • Java Beans Invironment

    salam to all
    please help me to learn java beans. i need to know what is java beans invironment?
    and we need to know how can i compile and run a java beans program?
    i hope to send a simple program to learn java beans
    salam

    salam to all
    please help me to learn java beans. i need to know what is java beans invironment?All you need to compile and run Java Beans is the JDK. There used to be a Sun product called the Bean Box, but I don't think anyone uses it now.
    and we need to know how can i compile and run a java beans program?Compile using javac.exe; run using java.exe
    i hope to send a simple program to learn java beansGive this a look:
    http://java.sun.com/developer/onlineTraining/Beans/JBeansAPI/shortcourse.html
    salam

  • Java Bean & JDBC

    Hi ,
    How can i use a non visual java bean in an EJB .
    i want my application to work with the app server & without it . I want to
    have the business logic in java beans and reuse it in EJB.
    How can we do that..
    thanks

    Sampath wrote:
    Hi ,
    How can i use a non visual java bean in an EJB .
    i want my application to work with the app server & without it . I want to
    have the business logic in java beans and reuse it in EJB.
    How can we do that..
    thanksYou can do mostly whatever java code you want in hand-written EJBs (BMP).
    See the spec for restrictions. This group is about jdbc. Do yoiur non-visual java
    beans have anything to do with jdbc? If so, would you want their DBMS work to
    be included in the EJB transaction, or just have the EJB call them and not need
    to know what they do?
    joe

  • Help required in building up the Java Bean for an XML data

    Hi ,
    I want to build a Java bean which will actually represent an xml data . The class will be named as User and it will typically represent the data in the follwing xml:
    <user>
    <cwsId>barbete</cwsId>
    <firstName>William</firstName>
    <lastName>Barber</lastName>
    <status>true</status>
    <role>
    <roleCode>1000000177</roleCode>
    <roleName>Customer Administrator</roleName>
    </role>
    <language>en</language>
    <country>US</country>
    <preferences>
    <equipmentGroup>2717</equipmentGroup>
    <dateFormat>MON-dd-yyyy</dateFormat>
    <timeFormat>HH:MI AM</timeFormat>
    <timeZone>-12:00</timeZone>
    <daylightSavings>Y</daylightSavings>
    <location>NC</location>
    <recordsPerPage>10</recordsPerPage>
    <historyPeriod>3</historyPeriod>
    <distanceUnit>MILE</distanceUnit>
    <fuelUnit>G</fuelUnit>
    <unitIdDisplay>E</unitIdDisplay>
    <smuUpdate>W</smuUpdate>
    <countries>
    <country>
    <countryCode>GB</countryCode>
    <countryName>UNITED KINGDOM</countryName>
    </country>
    <country>
    <countryCode>US</countryCode>
    <countryName>UNITED STATES</countryName>
    </country></countries>
    </preferences>
    </user>
    Now for single child nodes like cwsId of the main user node i have kept properties like
    private String cwsId;
    But i am not sure as to how to represent the nodes which contain subnodes like "preferences"node. Any ideas?What is the standard practice?

    One thing you could do is create an object model first, which will contain all the data for your user.
    then all you need in the bean is a Hashtable with the name of the user as a key, and the user-object (which is actually the complete object model) as a value.
    with the XML stated by you, you would get an object model something like this:
    Class User
        String cwsid;
        String firstName;
        ArrayList<Role> roles = new ArrayList<Role>(); //I'm assuming a user can have more then one role.
        ArrayList<Country> countries = new ArrayList<Country>();
    class Role {
        String code;
        String name;
    class Country {
        String code;
        String name;
    }And so on for all the varioous elemets of your XML.

  • Can we run java bean from forms client server??

    Hi,
    The OLTP application we are planning to build has lot of gui e.g
    tabs, drag and drop etc. Our aim is to make it web enabled but
    the network bandwidth available is small 16 - 64K . So even
    thoughwe plan toi use applet , we seriuosly doubt how good it
    will perform on such low network bandwidth. [The system will
    have 100 users]
    Q1. What will be a reasonable bandwidth to run an oltp
    application (say maintenance )
    Hence we are thinking of developing with developer 6i and
    deploying our application in client server mode, which can
    easily be web enabled in future. But we also have to integrate
    visual interfaces like gantt chart, which are not available with
    forms. We plan to use third party java component (e.g ILOG
    jviews), so that in future we can easily web enable the entire
    application.
    Q2. Can we run forms with java bean in client server mode? If
    not, what are the products to be installed on each machine to
    run it without using 9ias?
    best regards

    Yes. We can run sql loader from client machine.
    C:\Karthik>sqlldr user/pass@database data='test.csv' control='test.ctl' log='test.log' bad='test.bad'
    You can go through the following link for better understanding.
    http://www.oreilly.com/catalog/orsqlloader/chapter/ch01.html

  • I can not fine the Entity Bean's advantage than Java Bean?

    I can not fine the Entity Bean's advantage than Java Bean,
    can you tell me, thanks a lot?

    I can not fine the Entity Bean's advantage than Java
    Bean,
    can you tell me, thanks a lot?I think you should read more of the EJB Spec. You'll find your answer there. But mainly with entities you can have the container manage all the lifecyle of the Bean (transactions, caching, creation, etc...). But entities are not only to map columns in the database, they are supposed to have business code. See more by reading the spec.
    MSB

  • Can we Return values from Java Bean to Form

    Hi All,
    I have a Bean area defined on a Form. The Bean Area consists of a Text field which gets populated by path of a file selected using Browse button.
    Can I return this path as a parameter from the Java Bean to the form? Is there any function for this?
    Regards,
    Prathima.

    If you designed your bean to offer the ability to exact info/data from it, then yes you can get a value from the bean into the form (pl/sql) - using Get_Custom_Property
    Refer to the following which is a good example of how to build a bean. Specifically look at page 12 where is shows how to use Get_Custom_Property.
    This is NOT an Oracle supported or provided document or web site, but it is a very good example.
    http://forms.pjc.bean.over-blog.com/ext/http://sheikyerbouti.developpez.com/forms-pjc-bean/first-bean/first_bean.pdf

Maybe you are looking for