Marking a field as non-persistent?

Hi folks,
We've been building up a distributed data store that has a BDB at each leaf node. There are a few layers that our objects go through, and up until now we've been able to use our Entity objects directly throughout the code. They get serialized by RMI and make their way to our BDB nodes and get persisted by the DPL.
But now we have a situation where we have a field that we want serialized (non-transient) so that it makes its way all the way through our system, but then not persistent when it reaches the DPL. (We also have a search index at each leaf, and this bit of data includes some instructions for the search engine.)
The best solution (from my perspective!) would be simply to have an @NonPersistent annotation to make the DPL ignore a particular field. Lacking that, I came up with a couple options, neither of which I like. First, I could add a wrapper object that isn't an Entity class that contains my non-persistent data. I don't really like this idea, but it could work (makes all my objects a little larger and they get serialized a LOT). Second, I could modify readObject and writeObject to manually throw in the transient fields that I wanted to keep around. I don't really like that either (for different reasons), but it also could work.
Any other thoughts? Is there anything I'm missing that would allow me to do this easily?
Thanks!
Jeff

Hi Jeff,
I think the addition of @NonPersistent is a reasonable request and probably the only good solution. One of the primary goals of the DPL is to be able to persist objects that are used in other ways -- RMI is a good example. In other words, the DPL intends to be a pure POJO persistence solution. However, we didn't consider the case of a field that is persistent with respect to RMI but not the DPL, or vice-versa. So I think solving this is important.
Let us spend some time on that and we'll see if we can get this into a 3.3 dot release. This is a fairly simply addition, but we'll need to also consider the reverse situation -- a field that is persistent WRT the DPL but not RMI. In other words, we may need both @Persistent and @NonPersistent to apply to a field to override the default rules. And we'll need to encapsulate this information in the EntityModel abstraction so that it can be used without annotations.
In the meantime, I suggest using one of the workarounds you mentioned, or perhaps even modifying the DPL source code in a way that works for you, temporarily.. If you choose the latter, note that there is only one place where field persistence is determined, which is in the getInstanceFields method of this class:
src/com/sleepycat/persist/impl/FieldInfo.java
See the call to Modifier.isTransient.
--mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to mark ALBPM messages as non-persistent?

    Hi,
    When using the WLS JMS Server, persistence for the messages sent through the queue is not required since ALBPM uses the JMS Queue as a dispatching mechanism only. However, since the messages sent to the Queue are marked as “Persistent”, you must mark the Queue as “Store Enable”. This will allow the WLS JMS Server to accept messages that are marked as “Persistent”. Is there any setting by which we can make these messages as non-persistent so that queues don't have to be store enabled?
    Regards,
    Xavier

    The idea behind this is to increase the speed by using non-persistent queue.
    Please help.
    Regards,
    Xavier

  • Non-persistent fields

    Hi,
    I would like to use toplink with objects that contains both persistent and non-persistent fields (unmapped). When I insert such an object to the database using unit-of-work, and then try to query toplink for that same object elsewhere in my program I only get the persistent fields. I've tried using checkCacheThanDatabase() which resolved the problem but this method is only available for ReadObjectQuery not for ReadAllQuery (the javadoc is not consistent with the code).
    My questions:
    1. For ReadObjectQuery, can I trust the cache to always have my object, or is there a risk that the cache will drop it?
    2. What to do with ReadAllQuery?
    3. Any other approach that can work?

    You can make non-persistent attributes remain with the object in a unit of work through using a clone policy and using the postMerge event.
    Your class needs to implement Cloneable and in the descriptor use clone-copy-policy. This will ensure that when a cached object is registered into the unit of work the non-persistent attributes will be maintained.
    When the unit of work merges a transactional object into the session cache you need to make sure you copy the non-persistent attributes from the clone to the cached object. You can do this through a DescriptorEventListener and the postMerge event.
    Example:
    postMerge(DescriptorEvent event) {
    String tempProperty = ((MyClass) event.getObject()).getProperty();
    ((MyClass) event.getOringalObject()).setProperty(tempProperty);
    Note that since the attribute is non-persistent it will not be guaranteed to persist indefinitely. The non-persistent attributes duration will be dependant on your caching policy, if it gets dropped from the cache, a new instance will be built from the database the next time it is accessed.
    The checkCacheThanDatabase checkCacheOnly properties should not have any effect on what you get from the cache. Reads that access the database will still maintain object identity with the cache, and you should get back the correct object.

  • Updating non-persistent fields in an Entity Object

    Hi,
    I wanted to add a non-persistent field to an Entity Object to use as a temporary aggregate field for a detail entity. It appears that storing data in the field makes it look like the master entity has been updated even though the value cannot be saved in the data base. Is this the way it is supposed to work?
    I was trying to avoid putting invisible controls in the UI or creating "global" variables.
    Thanks,
    Peter

    This can be done with programmatic VOs: http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#sm0341
    Sample: http://blogs.oracle.com/smuenchadf/examples/#132
    You can also opt to do this with a simple Java class and a data control based on it.
    For example: http://blogs.oracle.com/shay/2009/07/java_class_data_control_and_ad.html

  • Need to cache non-persistent field value

    Is it possible to have a non-persistent field in PC class which value will be updated by app, stored in DataCache and then can be used when PC instance will be taken from DataCache next time?
    I tried to map my field as persistence-modifier="transactional" or "none". I do see in my log that the object is taken from cache, but that transient field value is always null after object retreival.
    Thanks, Denis.

    Thanks for the hint, Abe.
    I got what I need via custom filed mapping. If anyone interested:
    public class CacheFieldMapping extends ColumnFieldMapping {
    public CacheFieldMapping(FieldMetaData meta) {
    super(meta);
    public String getMappingType() {
    return getClass().getName();
    protected int getJDBCType() {
    return Types.OTHER;
    public boolean map() {
    return true;
    public void fromMappingInfo(MappingInfo info, boolean adapt) {
    // do nothing...
    public void toMappingInfo(MappingInfo info) {
    // do nothing...
    public void refSchemaComponents() {
    // do nothing...
    public int select(Select sel, KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch, int eagerMode) {
    return -1;
    public void load(KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch, Result res) throws SQLException {
    // do nothing...
    public void load(KodoStateManager sm, JDBCStoreManager store,
    JDBCFetchConfiguration fetch) throws SQLException {
    sm.storeObject(getIndex(), null);
    public Object loadProjection(JDBCStoreManager store,
    JDBCFetchConfiguration fetch, Result res, Joins joins) throws SQLException
    return null;
    public Boolean isCustomInsert(KodoStateManager sm) {
    return Boolean.TRUE;
    public Boolean isCustomUpdate(KodoStateManager sm) {
    return Boolean.TRUE;
    protected void update(KodoStateManager sm, Row row) throws SQLException {
    // do nothing...
    "Abe White" <[email protected]> wrote in message
    news:[email protected]..
    No, this is not possible. The data cache acts exactly like the
    database, only storing persistent values.

  • Problem creating non-persistent Child Objects

    I have the need to create a non persistable child object in the
    jdoPreStore of a parent object. I then perform some tests on the parent
    to determine if the child object needs to be persisted or not. If I leave
    the child non persistent it still writes to the database.
    I was performing the follwoing piece of code
    Class Parent {
    // The relationship is a 0 to many
    public Child createChild() {
    Child child = .....//create non persistent object
    child.setParent(this);
    getChild().add(child);
    It appears that if I remove the getChild().add(child). It does not
    persist (as desired).
    Is this correct behaviour?? I dont think that it should be, but if it is
    then I have a further problem.
    If that child object inherits from another object and you remove the
    getChild().add(child) kodo outputs an invalid object to the database. It
    doesnt insert a row to the child table. But it inserts a row to the
    childs inherited object table. This is now an invalid object and will
    fail upon loading.
    Any help on this would be appreciated.
    Thanks
    Luke.

    JDO has something called persistence by reachability. This means that
    objects do not have to explicitly be marked as to be persistent as JDO
    will traverse the object graph to ensure that all nodes are persistent.
    I think you are seeing this behavior combined with another side
    behavior: Kodo requires that both sides of a relation be set.
    Basically, keep your objects in synch (set both sides of the relation).
    And if you want to hold onto a reference to non-persistent object
    before you decide what to do with it, add a transient field or a field
    marked "persistence-modifier="none"" in your metadata and then process
    those transient fields in jdoPreStore ().
    i.e.
    if (//businessLogic is true)
    persistentField = transientField;
    Luke wrote:
    I have the need to create a non persistable child object in the
    jdoPreStore of a parent object. I then perform some tests on the parent
    to determine if the child object needs to be persisted or not. If I leave
    the child non persistent it still writes to the database.
    I was performing the follwoing piece of code
    Class Parent {
    // The relationship is a 0 to many
    public Child createChild() {
    Child child = .....//create non persistent object
    child.setParent(this);
    getChild().add(child);
    It appears that if I remove the getChild().add(child). It does not
    persist (as desired).
    Is this correct behaviour?? I dont think that it should be, but if it is
    then I have a further problem.
    If that child object inherits from another object and you remove the
    getChild().add(child) kodo outputs an invalid object to the database. It
    doesnt insert a row to the child table. But it inserts a row to the
    childs inherited object table. This is now an invalid object and will
    fail upon loading.
    Any help on this would be appreciated.
    Thanks
    Luke.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Key fields and non-key field of condition table

    Hello Gurus,
          what is key fields and non-key field of condition table?
    thanks very much!

    Key field
    Each condition table contains keys that can be used for creating dependent condition records.
    for example let take condition type PR00.
    PR00 uses access sequence PR02 .
    Access sequence PR02 has following tables associated with it namely 304, 305 & 306
    When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
    In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
    Non key field
    For example take condition table 144 - sales deal basic data.
    Table 144 is associated with access sequence PBUD.
    If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
    So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
    Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.

  • Single Persistent instance of a Object, Many non persistant. Same Identity on persist

    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.

    You cannot. You should either find the object by query or retrieve it
    using application identity.
    Graham Cruickshanks wrote:
    I have a persistent bean class with two Strings as member fields. (example
    below)
    I have many other classes that use it a part of they're member fields.
    I need to have only one persistant version of it (One row, to many Rows in
    different tables). But can have many non persistant versions. I can't
    control the creation of the non persistant objects.
    i.e.
    On persist, How can I configuration JDO to detect that it's the same as an
    object already in the database and use that instead?
    example:
    // Example class One
    package foo;
    public class One(){
    public String var1;
    public String var2;
    public String getVar1(){
    return this.var1;
    public void setVar1(String var1Set){
    this.var1 = var1Set
    public String getVar2(){
    return this.var2;
    public void setVar2(String var2Set){
    this.var2 = var2Set
    /// one.jdo
    <?xml version="1.0"?>
    <jdo>
    <package name="foo">
    <class name="One"/>
    </package>
    </jdo>
    ///Example Scenario
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database
    /// Some time later, in a different thread, or since JVM shutdown and
    restart
    One oneObject = new One();
    oneObject.setVar1("Value1");
    oneObject.setVar2("Value2");
    pm.makePersistent(oneObject); // one row in database, instead of two.
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Collection of non-persistent objects

    Greetings
    Is it possible to persist a Collection of non-persistent objects through the
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    ..droo.

    If you store them in some sort of externalized form in a single column it is
    easy - just use externalization framework to ext and de-ext them to anf from
    string. Couple of caveats you need to be aware of If your collection objects
    are mutable:
    1. You need to durty your collection field so it get prsisted on commit
    2. on rollback Kodo will restore you collection content but not collection
    member content. If they are mutable you will have to make their class
    persistent with mapping "none" so they participate in transaction
    "Drew Lethbridge" <[email protected]> wrote in message
    news:BD0B44BF.544%[email protected]..
    Greetings
    Is it possible to persist a Collection of non-persistent objects throughthe
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    .droo.

  • Non-persistent Queues and JMS API

    Hi,
    Is it possible to use non-persistent queues via JMS API. My application will always get an NullPointerException when trying to create a queue receiver i.e.
    QueueReceiver rec = qsession.createReceiver(queue);
    Any ideas and thx in advance,
    Wolfgang

    Mark,
              If you want this persistent behavior for non-persistent messages, presumably
              for performance reasons, use a persistent QOS backed by a JMS server with
              a file store that has synchronous-writes-disabled. As long as the O/S and/or
              hardware
              doesn't crash, no data will be lost, even if the WebLogic server is killed.
              See the JMS performance whitepaper on dev2dev.bea.com for details.
              Tom
              Mark wrote:
              > If you define a queue to be non-persistent, then all data is lost in the event
              > of a hardware or software failure.
              > What about in the case of a clean shutdown of the weblogic server hosting the
              > queue?
              > Are the messages held in the queue, paged to disk and restored when the server
              > is restarted?
              

  • Office 365 ProPlus Shared Computer Activation on non-persistent VDI

    Hello everybody
    We've different customers that are using a non-persistent VDI solutions like VMWare Horizon or Citrix provisioning.
    Some of the customers wants to license the Office Suite via Office 365 ProPlus.
    When configuring Office 365 ProPlus with Shared Computer Activation and without AD FS we've the behaviour where users needs to login each time to Login to a machine, because after signou the machin gets restored.
    Is the only solution the one described in
    this article by using AD FS or is there another solution to perhaps store the provided Office 365 credentials and licensing information.
    As I'm aware a Office 2013 volume license Version cannot be used anymore starting on 1. August 2015 if licensed over Office 365 ProPlus because the use-righst for a volume license version are being removed.
    Thank you for clarification on that, because I'm not able to find on official statemant.
    Kind regards

    Hi,
    ADFS should be the primary choice for your case. In addition to this there are a variety of qualified third party identity providers that can be connected with Office 365 to provide the necessary single sign-on.
    Here is the reference, you might want to have a look and see if it is helpful for you:
    https://technet.microsoft.com/en-us/library/jj679342.aspx
    By the way, this is the forum to discuss questions and feedback for Microsoft Office client. There is not so much about Office 365
    hosted/integration services aspect here, I would suggest you to post in the forum of Office 365 Community, where you can get more experienced responses:
    http://community.office365.com/en-us/f/default.aspx
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Field "GR Non-valuated" in tab "Goods receipt" of the production order

    Hi,
    When creating a production order, the field "GR Non-valuated" in tab "Goods receipt" is checked by default, due to my assessment customizing.
    This field indicates to the system that it should not create any accounting document, whereas I would like to create one. Does anyone know how to withdraw this automatically check?
    FYI, I do not use COPA and the very basic of CO-PC and I would like to create automatically a default assessment rule (cost center).
    Thanks for your help.
    Ronan

    Hi,
    please note that this is not an MM, but a PP-SCF related issue. It does not belong to the forum ERP MM.
    The indicator AFPOD-WEUNB is set automatically as soon                  
    as you do not settle your production order to category 'MAT' (see                    
    settlement rule). If the order is not settled to a material, then the                
    Goods Receipt will not be valuated and the flag G/R Non-valuated (WEUNB)             
    is set. Only when you settle to a Material is the G/R Non-valuated not              
    set, and you will  receive FI postings in the case of such a movement.               
    This is standard system behaviour.                                                   
    Please review the following notes relating to settlement rules: 518496,              
    400400.                                                                               
    To make sure that the GR-Nonvaluated flag is not set in the                          
    production order, field KZBWS must already be filled with 'M' in the                 
    customer requirement. For that, please set the field KZBWS='M' for the               
    requirement class that is used (see 'General Customizing' in note                    
    459734). PLAF-KZBWS (indicator:valuation of special stock).  
    Regards,
    Edit

  • How to made Qty field as non editable in MIRO

    Hi SAP Gurus,
    While Post a Goods Receipt (MIRO) for Receive the Material from Job
    Worker, the Qty of Raw Material which needs to Issue or consume from
    Stock will propose as per PO BOM. The Qty field of Raw Material is in
    Editable Mode. Business wants that Qty Field to be Non-editable and not
    to allow user to Change the Proposed Qty. As per PO BOM and based on
    Material Received from Job Worker, Raw Material has to Issue or Consume
    from Stock. If any Under Consumption or Over Consumption will be
    adjusted thru MB04.
    Pls let me know is there any setting to make Raw Material Qty field as
    non editable.
    Thanks & Regards
    Sathish
    Ph:9940518715

    Hi,
    There is no field selection in MIRO.
    USE SHD0 and create a screen variant
    Thanks & regards,
    Kiran

  • Disabling fields(Make the field as non-editable)  in webdynpro ALV

    HI All,
    I have a requirement in the ABAP webdynpro where I have to disable(Make the field as non-editable) the field(or that ALV cell alone)  in the ALV after the user has inputed in that field.
    Is it possible, if yes, could you please give me some sample code , or links to which I can refer to.
    Thanks for your help.
    Regards,
    Subash M

    Hi,
    Use the following approach :
    1. Create an ALV and create an inputfield cell editor for the column that you want to make editable/disable.Refer this tutorial for creating an [Editable ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1]
    2. Now under the same node create an attribute EDITABLE type boolean and bind this to the readonly property of the input field. Include the following code while creating Input field for binding.
    lr_input_field->set_read_only_fieldname( 'EDITABLE' ).
    3. Now implement the onDataCheck event or OnCellAction event and pass abap_true to this attibute to make the cell readonly/disable.Refer this tutorial for [Events in ALV|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82d3e8]
    Hope this helps.
    Regards,
    Radhika.

  • Updating linked fields in a persistent class

    Hi all,
    If a field of a persistent class is updated, what is the best way to update a related field?
    Scenario:
    A persistent class with public GET/SET access to a table field STUFF, and public GET access to a field CATEGORY.
    Whenever SET_STUFF is called from the outside, the class should also re-evaluate and update CATEGORY.
    The easiest is to modify the SET_STUFF method to determine the new category and update it if necessary. However GET/SET methods are always overwritten whenever the class is regenerated, which happens all too easily. Can this be done a bit more elegantly?
    Most modifications can be done by redefinitions of the agent class and do not get overwritten each time the class it regenerated. e.g. I have done something similar by redefining the DB access methods to update various fields, but for my current requirement the update needs to be immediate, not during save.
    Any input appreciated,
    MIke
    Edited by: Mike Pokraka on Sep 15, 2009 4:12 PM

    Hi Naimesh,
    >
    Naimesh Patel wrote:
    > Updating the field CATEGORY immediatly would lead to some problems while working with Persistent class because of the COMMIT WORK. As soon as COMMIT WORK after the CATEGORY's "save" hits, all pending save request would execute and may update some fields which you don't want to update at that point of time.
    No COMMITs should be performed, that's part of what I'm trying to accomplish. STUFF may change several times during the lifetime of the process and CATEGORY must change with it. When the application finally does a COMMIT WORK then both are written to the DB. (In fact my real scenario involves both transient and persistent instances and multiple callers).
    My objectives are to have a readonly attribute in the persistent class that changes in response to other fields changing. It should behave as though the app is calling a SET_STUFF and a SET_CATEGORY, but the persistent class must retain control of the CATEGORY field as several applications can modify STUFF.
    My current workaround is an UPDATE_CATEGORY method that must be implemented by each caller, so it works. Layering another class above it an option but is a bit of overkill which also makes it a workaround.
    I have found that EXT_HANDLER_WRITE_ACCESS seems to provide something, but the comments in there seem to indicate I shouldn't modify the object info. Unfortunately I have run out of time to experiment this week so the workaround will have to stay for now, but I'd still be interested in a more elegant solution.
    Thanks for the input,
    MIke

Maybe you are looking for

  • Problem with bean in a JSP page

    I have developped a JSP pages in wich I call a bean with <jsp:useBean id="db" scope="request" class="SQLBean.class" /> The bean SQLBean.class is in the same directory as the JSP page. When I execute the JSP, I have the following error: SQLBean.class

  • Servlets - problem with session

    Hi there ppl, I have a login servlet which is called form a link in a static html page. The doGet() method is as below: public void doGet(HttpServletRequest request,           HttpServletResponse response)      throws ServletException, java.io.IOExce

  • Color tint shifts constantly during isight recording

    I recently updated from a 13" aluminum MacBook to a 13" MacBook Pro. When I record the video of the isight camera, the lighting color constantly shifts from red to green to red etc. Very annoying. It didn't do this with my 1 year old MacBook. The Mac

  • Thread stopping

    HI, I have a question regarding the use of threads in my program. I have 4 classes which I have implemented as Runnable. Each class uses it's run method to call methods which carry out queries on a database. I have a thread t which I use to run the m

  • Shorewall & iptables/netfilter capabilities

    I have VPS (OpenVZ & Arch Linuz 2010.05) and I try to use shorewall. Problem is that I need 'Recent Match', but that is not available. I don't know why. $ shorewall show capabilities NAT: Available Packet Mangling: Available Multi-port Match: Availab