Implement Maps keyed by a Persistent Class

Hi,
You would probably agree that JDO Maps keyed by a primitive/primitive
wrapper are not nearly as usefull as the ones mapped by a PC.
I wonder if it is in your plans to provide this functionality? Kodo 2.4? or
2.5
If I am not mistaken somebody (may be me) already entered this enhancement
request into your bugzilla as a part of overall collection handling
improvements but I am going to create a new request just in case and put
some of my votes onto it :-)
If you want me to come up with use cases to explain why I think this feature
is very much needed I can certainly do so.
Anyway if any other folks around here are interested in this feature please
wote for it http://bugzilla.solarmetric.com:8080/showvotes.cgi?voteon=437

This is on our project plan, but will not be in 2.4.
-Patrick
In article <apmh0t$a3r$[email protected]>, Alex Roytman wrote:
Hi,
You would probably agree that JDO Maps keyed by a primitive/primitive
wrapper are not nearly as usefull as the ones mapped by a PC.
I wonder if it is in your plans to provide this functionality? Kodo 2.4? or
2.5
If I am not mistaken somebody (may be me) already entered this enhancement
request into your bugzilla as a part of overall collection handling
improvements but I am going to create a new request just in case and put
some of my votes onto it :-)
If you want me to come up with use cases to explain why I think this feature
is very much needed I can certainly do so.
Anyway if any other folks around here are interested in this feature please
wote for it http://bugzilla.solarmetric.com:8080/showvotes.cgi?voteon=437
Patrick Linskey [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • Problem using different Map key types in one class

    I'm running Kodo 2.3.3. It seems I can only have one Map key types for all
    maps in a class. For example, if I have two maps in a class, their keys
    must be of the same type.
    Is there a plan to remove this limitation soon?
    Thanks,

    Abe White wrote:
    Kodo should generate a separate table for each Map. We have internal tests
    that use classes with Map fields using a lot of different key/value type
    combinations, so there shouldn\'t be a problem.It looks like two maps (keyValues and versions) are sharing the same
    table. Here is the table generated by schematool (db: Oracle 8.1.7):
    desc persistentmotiveresourcebean_x;
    Name Null? Type
    ID_JDOIDX VARCHAR2(255)
    JDOKEYX NUMBER
    KEYVALUESX VARCHAR2(255)
    VERSIONSX VARCHAR2(255)
    ==========================================================================
    Following is the simplified code I run:
    -----------internal.jdo--------------------------------------
    <?xml version=\"1.0\"?>
    <jdo>
    <package
    name=\"com.motive.services.resourceManagementService.internal\">
    <class name=\"PersistentMotiveResourceBean\"
    identity-type=\"application\"
    objectid-class=\"com.motive.model.PrimaryKey\">
    <field name=\"id\" primary-key=\"true\"/>
    <field name=\"versions\">
    <map key-type=\"java.lang.Float\"
    embedded-key=\"true\" value-type=\"java.lang.String\"
    embedded-value=\"true\"/>
    </field>
    <field name=\"keyValues\">
    <map key-type=\"java.lang.String\"
    embedded-key=\"true\" value-type=\"java.lang.String\"
    embedded-value=\"true\"/>
    </field>
    </class>
    </package>
    </jdo>
    Java source:
    -----------PersistentMotiveResourceBean.java---------
    package com.motive.services.resourceManagementService.internal;
    import java.util.HashMap;
    public class PersistentMotiveResourceBean
    private String id;
    private String name;
    private HashMap versions;
    private HashMap keyValues;
    public PersistentMotiveResourceBean()
    public String getId() { return id; }
    public void setId(String id) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public HashMap getVersions() { return versions; }
    public void setVersions(HashMap versions) { this.versions = versions; }
    public HashMap getKeyValues() { return keyValues; }
    public void setKeyValues(HashMap keyValues) { this.keyValues =
    keyValues; }
    ----------------PrimaryKey.java-------------------------------------
    package com.motive.model;
    import java.io.Serializable;
    public class PrimaryKey implements Serializable
    public String id;
    public PrimaryKey ()
    public PrimaryKey (String id)
    this.id = id;
    public boolean equals (Object ob)
    if (this == ob) return true;
    if (!(ob instanceof PrimaryKey)) return false;
    PrimaryKey o = (PrimaryKey) ob;
    return (this.id == o.id);
    public int hashCode ()
    return id.hashCode();
    public String toString ()
    return id;

  • Maps keyed by persistent Class

    Hello,
    Cold you please remind me whether Maps keyed by persistent Class are
    implemented in 2.5 or planned fro 3.0
    Thanks
    Alex

    It is implemented in 3.0.
    -Patrick
    On Fri, 27 Jun 2003 23:34:29 -0400, Alex Roytman wrote:
    Hello,
    Cold you please remind me whether Maps keyed by persistent Class are
    implemented in 2.5 or planned fro 3.0
    Thanks
    Alex--
    Patrick Linskey
    SolarMetric Inc.

  • On activating persistent class: There is no mapping for one or more fields

    Hi all,
    I'm using an ECC 6.0 system.
    I've just created a persistent class and defined the persistence. When I try to activate the class activating fails and I get the message "There is no mapping for one or more fields."
    I did not, in fact, use all the fields of the database table I defined the persistence on. When I do use all the fields activating the class works without a problem.
    However, as far as I know it should be possible to select only some of the fields when defining the persistence (the only fields I have to select are all the key fields of the table and I've done this).
    Has anybody encountered the same problem or has anybody any idea on this?
    Cheers,
    Kathy

    Hi Kathy,
    this is exactly what I meant.
    If you'd like, then you can also take a look at the documentation: http://help.sap.com/saphelp_nw04/helpdata/en/b0/9d0a3ad259cd58e10000000a11402f/frameset.htm
    There under Mapping, you can find:
    "You must map all columns of a database table to attributes. If you only want to manage some of the columns using Object Services, you must create a database view."
    Making attributes private doesn't change the fact, that you still map all fields. If you have a lot of fields, which you don't want to map, then I will again suggest, that you define a DB-view. This will boost the performance of your implementation.
    In case you need "quality 1st" performance, then I would suggest to use an ABAP implementation with internal tables, instead of the Persistent Service.
    HTH,
    Hristo

  • Weird exception: Cannot instantiate non-persistent class: java.util.Map

    java.lang.UnsupportedOperationException: Cannot instantiate non-persistent class: java.util.Map
         at com.sleepycat.persist.impl.NonPersistentFormat.newInstance(NonPersistentFormat.java:45)
         at com.sleepycat.persist.impl.PersistEntityBinding.readEntity(PersistEntityBinding.java:89)
         at com.sleepycat.persist.impl.PersistEntityBinding.entryToObject(PersistEntityBinding.java:61)
         at com.sleepycat.persist.PrimaryIndex.put(PrimaryIndex.java:338)
         at com.sleepycat.persist.PrimaryIndex.put(PrimaryIndex.java:299)
         at com.xx.support.dbd.IdentityDataAccessor.insert(IdentityDataAccessor.java:33)
         at com.xx.support.dbd.BerkeleyDBAccountStorage.saveUser(BerkeleyDBAccountStorage.java:95)
         at com.xx.support.bdb.BerkeleyDBAccountStorageTests.initBerkeleyDBData(BerkeleyDBAccountStorageTests.java:38)
         at com.xx.support.bdb.BerkeleyDBAccountStorageTests.setUp(BerkeleyDBAccountStorageTests.java:28)
         at junit.framework.TestCase.runBare(TestCase.java:125)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
    What's the root cause of this exception?

    I wrote a small test using the classes you included
    in your message and I am able to retrieve the user by
    key, as in the code above. So I'm not sure what
    you're doing that is causing the problem. Please
    send a small test that reproduces the problem.Oops, I forgot to include the source for the test I wrote. Here it is.
    import java.io.File;
    import java.util.HashMap;
    import java.util.Map;
    import com.sleepycat.je.DatabaseException;
    import com.sleepycat.je.Environment;
    import com.sleepycat.je.EnvironmentConfig;
    import com.sleepycat.persist.EntityStore;
    import com.sleepycat.persist.PrimaryIndex;
    import com.sleepycat.persist.StoreConfig;
    import com.sleepycat.persist.model.Entity;
    import com.sleepycat.persist.model.Persistent;
    import com.sleepycat.persist.model.PrimaryKey;
    public class Test {
        @Persistent
        public static class SimplePrincipal {
            protected String name;
            public SimplePrincipal(String username) {
                this.name = name;
            public SimplePrincipal() {}
        @Entity
        public static class SimpleUser extends SimplePrincipal {
            @PrimaryKey
            private String key;
            private Map properties;
            public SimpleUser() {
                super();
                this.properties = new HashMap();
            public SimpleUser(String username) {
                super(username);
                this.properties = new HashMap();
            public void setKey(String key){
                this.key = key;
            public void addPropertity(String name, String value) {
                this.properties.put(name, value);
            @Override
            public String toString() {
                return "[SimpleUser key: " + key + " name: " + name + ']';
        private Environment env;
        private EntityStore store;
        private PrimaryIndex<String, SimpleUser> primaryIndex;
        private void open()
            throws DatabaseException {
            EnvironmentConfig envConfig = new EnvironmentConfig();
            envConfig.setAllowCreate(true);
            envConfig.setTransactional(true);
            env = new Environment(new File("./data"), envConfig);
            StoreConfig storeConfig = new StoreConfig();
            storeConfig.setAllowCreate(true);
            storeConfig.setTransactional(true);
            store = new EntityStore(env, "test", storeConfig);
            primaryIndex = store.getPrimaryIndex(String.class, SimpleUser.class);
        private void close()
            throws DatabaseException {
            store.close();
            env.close();
        private void execute()
            throws DatabaseException {
            SimpleUser user = new SimpleUser("test");
            user.setKey("testkey");
            primaryIndex.put(user);
            user = primaryIndex.get("testkey");
            System.out.println(user);
        public static void main(String[] args)
            throws DatabaseException {
            Test test = new Test();
            test.open();
            test.execute();
            test.close();
    }Mark

  • Error while activating a persistent class

    Hi,
    I have created a persistent class and included fields of the custom table in persistent mapping.
    But when I tried to activate the class I am getting the following error
    Method IF_OS_FACTORY~CREATE_TRANSIENT has already been implemented.
    Pls suggest how this can be resolved.
    Regards,
    Savitha

    Hi Savitha,
    By the error I can deduce that there are multiple implementations done for the method CREATE_TRANSIENT
    of the interface IF_OS_FACTORY which is not recommended..
    So please check the Where used list of that method or interface so that you could come to a conclusion.
    Hope this would help you.
    Good luck
    Narin

  • Is it possible to use a secondary index in embedded persistent class

    Hi,
    I'm new to Berkely DB Java Edition and have just started playing with it.
    To express a relation between two entities Foo and Bar, I am trying with an assocation class FooBarAssociation that is not an entity but rather a @Persistent-annotated embedded class in Foo (Foo has a collection of FooBarAssociations). Now I'm looking for a way to find all Foos associated with a given Bar id by use of an index. Can this be done? Is the use of the SecondaryKey in the embedded class at all correct? If this is not the way to go, can it be done any other way (except from using three entities)?
    @Entity
    class Bar {
        @PrimaryKey
        private int id;
    @Persistent
    class FooBarAssocication {
        @SecondaryKey(relatedEntity=Bar.class, relate=Relationship.ONE_TO_ONE)
        private int barId;
    @Entity
    class Foo {
        @PrimaryKey
        private int id;
        private Set<FooBarAssocication> fooBarAssociations = new HashSet<FooBarAssocication>();
    }Any help much appreciated.
    /Martin Söderström

    Martin,
    So could this be done with the embedded persistent class like this, or should I give up and make the FooBarAssociation class an entity of its own?A separate relationship entity class will definitely work, as described in the SecondaryIndex javadoc.
    But SecondaryKey fields have to be at the top level of an entity class, so an embedded class that contains the secondary key (and other attributes) won't work.
    Logically, you have a one-to-many relationship from Foo-to-Bar, and the relationship has attributes.
    If you store the relationship in the Bar entity, then it's pretty easy because there is one Bar instance per relationship and other attributes can easily be stored there. I know you said you want to put it in the Foo class because it logically belongs there, but I'll show this alternative anyway for completeness:
    @Entity
    class Bar {
        @PrimaryKey
        private int id;
        @SecondaryKey(relatedEntity=Foo.class, relate=Relationship.MANY_TO_ONE)
        private int fooId;
        private Date createTime;
    @Entity
    class Foo {
        @PrimaryKey
        private int id;
    }If it's really important to put the relationship fields into the Foo class, then you can do something like the following. It's messy to attach relationship attributes, but it can be done with either a parallel list or map.
    Also, be sure to read the "Key Placement with Many-to-Many for Related Entities" section of the SecondaryIndex javadoc page.
    @Entity
    class Bar {
        @PrimaryKey
        private int id;
    @Entity
    class Foo {
        @PrimaryKey
        private int id;
        // Use one of the following, either this:
        @SecondaryKey(relatedEntity=Bar.class, relate=Relationship.ONE_TO_MANY)
        private List<Integer> barIds = new ArrayList<Integer>;
        private List<Date> barCreateTimes = new ArrayList<Date>;
        // Or this:
        @SecondaryKey(relatedEntity=Bar.class, relate=Relationship.ONE_TO_MANY)
        private Set<Integer> barIds = new HashSet<Integer>;
        private Map<Integer, Date> barCreateTimes = new HashMap<Integer, Date>;
    From reading the documentation I also get the feeling that I could use the Base API and set up a SecondaryDatabase to create a secondary index for a case like this (correct?).Yes, you could do that, but I would hate to see you move to the base API just for this issue. The DPL is much easier to use (and easier for us to support).
    Anyway, so far the BDBJE looks very promising to us. It may replace our current Hibernate solution.Great. We'd love to hear more about what you're doing, why JE works well for you, etc, either on the forum or privately if you prefer (mark.hayes at o.com). It helps us a lot to know what people are doing with JE.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • OO Design--do ABAP Persistent Classes make sense for ALV reports in NW2004?

    Hello experts,
    At our company, we started using ABAP OO in the last year.
    I am on NW-2004 .  We just acquired a business that is on 4.6C.
    We have a lot of customization to bring into our system. There are a lot of reports with common queries that span multiple tables.
    I would like to follow the best practice for OO design and create global classes for the data access layer  the business logic layer and the UI layer.  For the UI layer, I will be utilizing the SALV class, since NW2004 doesn't have ABAP WebDynpro (we don't have a java stack available for development and software change management).
    For the data access layer,  I would like to use the persistent classes,  but without the query manager, it just doesn't make sense.
    Thomas Jung said in a blog that he sometimes used SQL to get the keys and then used persistent classes to retrieve the remaining data.  But for straight ALV reporting, that just seems inefficient.  But it could be that I am just not familiar enough with the technology.
    I am looking for suggestions on how to design the data access layer for these intense  and commonly used queries.
    (Ironically, we will upgrade to NW2004s after this migration -- ouch!)
    All ideas are appreciated.
    Thanks.

    Hi Kimberly,
    the main advantage of persistent objects is that their state can be saved in the database. If a persistent object changes in your program, these changes can be reflected in the corresponding database field(s). Thus, persistent objects are very useful when doing CRUD (create, read, update and delete) operations with business objects.
    However, if you just want to read data (for simple reporting) but do not plan to implement any of the other CRUD operations, I doubt if a persistency layer is necessary since this causes extra effort during design time and runtime. In that case, simple SELECT statements seem to be more appropriate.
    Regards,
    David

  • Improving persistent class performance with on-demand DB reads?

    Hi,
    Something that has been troubling me for some time is the data access design of persistent classes. A persistent class loads the ENTIRE data set when it is instantiated.
    To me this defeats one of the advantages of get/set methods. What I would like is to be able to read data when it is first accessed.
    For example: A purchase order header can be loaded in a few ms. However with items it can take 10 times as long - even more if the items are implemented as persistent classes themselves. If items are only needed half the time, a significant performance gain is realized by only reading items the first time the GET_ITEMS method is called. In my own persistence implementations using BI_PERSISTENT (Nothing to do with ABAP Persistent Classes), I implement this using private attributes to buffer data, along the lines of:
    method get_items.
      if m_items[] is initial.
        m_items = <read and/or instantiate items>.
      endif.
      re_items = m_items.
    endif.
    Using ABAP Persistent Objects this does not appear to be possible since they insist on loading everything up front in the DB mapping or IF_OS_STATE~INIT methods. Is some kind of on-demand reading possible using ABAP Persistent Classes?
    Any input appreciated
    Cheers,
    Mike

    Hi Mike,
    yes, I am also very interested in this topic. While developing my first (and only a mid-complex) persistence application, I am expecting slightly different behaviour of linked persistent objects than you described above. According to the book 'Object Services in ABAP' and lazy loading paradigm mentioned there, the referenced persistent objects should be instantiated as representative objects only, containing no data, and the data should be physically loaded from database only once it's really needed (ie. accessed or explicitly instantiated). This should be the approach preventing the situation of mass chained instantiation of many linked persistent objects where most of them will not be needed, probably.
    This is what they say about instantiation of persistent objects that are linked by persistent references.
    However, since the persistent objects do not allow creating of 1:N relationships (classics: HEADER->ITEMS) via persistent references automatically, then this kind of relationship has to be maintained manually and therefore I expect you having full control of when it is accessed and instantiated for the first time...? What I want to ask here is then: is there any suitable approach which allows to maintain 1:N relationship fully or semi-automatically and which (as a disadvantage) makes the problem for you with 'full' instantiation? Am I missing something? There are also some threads Table attributes and persistent classes  regarding persistent mapping of table-like attributes, but no relevant answers (this should solve my problem as the table of persistent references could be saved then).
    Until now, I have found almost nothing about how the 1:N relationship should be correctly built (only 1:1 or M:1 is supported via persistent references), so I am applying the following approach in my app. Any comments are welcome (excuse some typos, as this is written in Notepad, not on the running system):
    ref_header = zca_header=>agent->create_persistent( ).
    guid_of_header_class = ref_header->get_cl_guid( )."cl_guid is set in IF_OS_STATE~INIT
    guid_of_header_instance =
      zca_header=>agent->if_os_ca_service~get_oid_by_ref( ref_header ).
    ref_header->set_inst_guid(                   "keep header inst. ref. for future lookups
    i_inst_guid = guid_of_header_instance
    lt_r_items = ref_header->create_items(       "lt_r_items = table of items references
      i_cl_guid = guid_of_header_class
      i_inst_guid = guid_of_header_instance
      it_items = lt_items )
    and the method zcl_header->create_items then looks somewhat like this:
    loop at it_items assigning <it_items>.
      ref_item = zca_item=>agent->create_persistent( ).
      ref_item->set_cl_guid( i_header_cl_guid = i_cl_guid ).
      ref_item->set_inst_guid( i_header_inst_guid = i_inst_guid ).
      ref_item->set_some_other_attrib(
        i_some_other_attrib = <it_items>-some_other_attrib
      append ref_item to rt_r_items.             "rt_r_items = table of items references
    endloop.
    I have created a secondary index on items for header_cl_guid and header_inst_guid. This is used during the re-load of already saved items for particular header entry. Query service is used with header_cl_guid and header_inst_guid of actual header entry as filter criteria for item pesistent objects and table of item references is returned. Thus the instance attribute lt_r_items of ref_header is filled with references to relevant items again.
    Thank you
    Michal

  • Problem in creating a Persistent Class

    Hi All,
    I am working on Persistent Classes for the first time. I have tried to gain some info by going through some related threads and of course Thomas' Blog on Persistent Classes.
    My Problem:
    I have been trying to create a Persistent Class that takes fields from multiple database tables (KNA1 and KNVV).
    I wasn't able to generate mapping successfully.
    So, the solution was to create 2 Persistent Classes and create a data model class for these two (It was mentioned in one of the threads)
    I have been trying to create a Persistent Class for the fields from table KNA1 (I need only some 11 fields)
    When I activate, I again get a warning 'No mapping exists for the fields' as a result of which the main class is not activated.
    I read somewhere that all fields from a table needs to be included in the 'Inclusion area', otherwise, the class doesn't activate.
    So I tried creating a view, but I get another warning message saying 'Database operations with view are not allowed' and the main class remains unactivated.
    Please suggest.
    Also, if there are any related materials on how to deal with multiple tables, I would be more than glad.
    Thanks for all your time.

    If you are creating a persistent class for SAP tables, then effectively you are attempting to update the tables directly.  And that is a really bad idea.
    See [here|regarding updation of database table...; and [here |Important points to be cautios of when updating a standard table; for more discussion on that topic.
    Only create persistent classes for database operations on your own tables.
    I guess your classes are failing because you haven't done the mapping.  Did you click on the button marked "persistence" on the SE24 view of your ZCL class?
    matt
    One more thing - it's against the forum rules to ask for material and links...

  • Problems in actvating a persistent class

    Hello All
    I have created a persistent class. When I am trying to activate it I am getting a
    message in status bar that
    'There is no mapping defined for one or more fields'.
    I have defiend 4 attributes in the class - then clicked on the PERSISTENCE tab in
    in the main toolbar, gave the table name and mapped the table fields to the class attributes. Still I am getting the message.
    Could anyone please suggest why this is happening?
    Also could anyone please explain to me why do we always need to define the instantiation as "protected" when creating a persistent class.
    Thanks in advance.
    Regards
    Indrajit

    Hello All,
    The problem is solved.
    I was of the understanding that I can take only few of the table fields and map it to class attributes. So I took only 4 fields of the table SPFLI and mapped it to the corresponding 4 attributes of the persistent class. So I was getting the message that
    'There is no mapping defined for one or more fields'.
    So I tried by defining class attributes corresponding to all fields of the table and mapped accordingly all table fields. This time I could activate the class.
    This I believe is a constarint because one may not be really interested in all fields of the database table.
    Regards
    Indrajit

  • 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

  • Change documents with persistent class

    Hi,
    I have created a persistent class and want to use a set-method to change data in the mapped table - nothing special.
    But: Does anybody know if there's a possibility to write change documents for the changed field without calling FMs like CHANGEDOCUMENT_SINGLE_CASE?
    There would be the event if_os_state~changed but unfortunately no information about the changed field itself is available in this event. Is it possible to redefine events?
    Thanks a lot for each answer!
    Best regards
    Jörg

    Hi Narin,
    thanks for your answer!
    The first point is plain to me (although I don't really feel happy about this ) but I have problems understanding your second point because I don't really know what "Business object events" are... I'll try a different phrasing, maybe this is better:
    My persistent class inherits the event if_os_state~changed. Can I redefine this event in my class so that I can add an additional parameter where I can put the information about the changed attribute?
    Jörg

  • Regarding persistent classes  & objects

    Hi all,
    I am new to abap objects, please  give me some simple links of persistent classes & object.
    Let me know the difference between persistent classes & other simple classes..
    I ensure you for points!
    cheers.

    Hi,
    Transient and persistent data
    In principle, ABAP programs work with local program data, which resides in the program’s internal session. This data lives only as long as its context – that is, as long as its associated procedure (for local procedure data); its object (for attributes of classes); or its program (for global program data). This data is known as transient. Data that can be preserved beyond the runtime of the program is known as persistent. In SAP Systems, persistent data usually occurs as the content of database tables, but also as the content of files on application and presentation servers.
    To work with persistent data, the system has to load it into transient data objects belonging to the ABAP program while that program is being executed. Then, after processing has been completed, it stores the data in a persistent form again. During this time, the content of the data exists twice: once in the ABAP program (transiently), and once in the appropriate storage medium (persistently). A typical process would be reading data from a database table using the SELECT statement into a transient work area; modifying the work area; and then updating the database table (using UPDATE). In such cases, the contents of transient and persistent data are different in the interim during this process.
    Data in object-oriented programming
    In an ideal object-oriented application, data occurs only as the attributes of objects (if we ignore the local data in methods for the time being). Objects are an aggregation of functions (in methods) and data (in attributes). The description of an object – that is, the class – occurs persistently as a piece of source code, but its attributes exist only as long as the object. However, an object in ABAP Objects is transient in principle. It exists in the internal program session only from the time it is generated (using CREATE OBJECT) until it is deleted by the Garbage Collector. Therefore, to work with persistent data in objects, you must program access to where those objects are stored within the methods of the class.
    However, in completely object-oriented business application programming, then it is pointless simply to transfer the classical separation of data and functions to the methods – that is, to work with objects, but use procedural programming within the objects themselves. Ideally you could save the encapsulation of data and functions persistently within the object instead. A program could then leave an object in a certain state and a second program could continue working on the object in that state. Classes of objects are already persistent anyway, but you need some way of saving the attributes of an object persistently and then make reference to the appropriate class. The Persistence Service allows you to do exactly that.
    Persistent Classes
    To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the Persistence Service to ensure that the content of each persistent object is unique.
    Managed Objects
    The objects of persistent classes are managed by the Persistence Service. This means, among other things, that these objects are instantiated with a method of the class actor, not with the CREATE OBJECT statement. These objects are known as managed objects. Objects managed by the Persistence Service can be either persistent or transient.
    Persistent objects must be managed by the Persistence Service. The Persistence Service connects the object and the database.
    Transient objects of persistent classes are also managed by the Persistence Service. For example, the Persistence Service ensures that the object is unique within a program (by checking its key attributes), but not for a connection to the database.
    Plz refer to this link:
    http://help.sap.com/saphelp_nw70/helpdata/en/f5/a3682ebc6911d4b2e80050dadfb92b/content.htm
    Thanks,
    Samantak.
    Rewards points for useful answers.

  • How to abstract colums from persistable class(s)

    for example, i have some common column (created, modified, etc) for all
    tables and i don't want to mape the common columns in every single class.
    i know kodo has the following restriction in Inheritance
    "If a persistent class inherits from a non-persistent class, the fields
    of the non-persistent superclass cannot be persisted"
    is there any workaround for this, can any one help me
    Thanks

    That's no longer a restriction -- you can do what you indicated by using
    Kodo's horizontal mapping support.
    -Patrick
    kailasam.k wrote:
    for example, i have some common column (created, modified, etc) for all
    tables and i don't want to mape the common columns in every single class.
    i know kodo has the following restriction in Inheritance
    "If a persistent class inherits from a non-persistent class, the fields
    of the non-persistent superclass cannot be persisted"
    is there any workaround for this, can any one help me
    Thanks

Maybe you are looking for

  • Disk Utility Restore Process Input/Output Error

    <Image Edited by Host> My niece's MBP specs above. If I posted a picture of this poor machine, there'd be a lynch mob of passionate Apple fans arrive at my door wanting a public hanging...It's been dropped no less than a dozen times. (The ethernet po

  • Green screen in webcam when I open Photo Booth?

    I just bought my new Macbook Pro two weeks ago and sometimes when I open Photo Booth before I appear in the web cam it just turns green for .5 seconds.. is this a defect in the camera, or what? This computer is brand new and I am quite perturbed and

  • Getting problem in Dashboard Prompts

    Hi All, I have designed a dashboard prompt for the time which captured data for month,quater and year. when i click on the month option to select some data and for example i have selected all the data from the month and click on ok and when again i o

  • CONVT_CODEPAGE codepage '4110' to codepage '4103'

    Hi Experts, I'm really new with ABAP and I'm trying to ivestigate as to why a job got cancelled previously. As per DUMP information: Short text                                                                                A character set conversion

  • Material column is empty in VF04

    Hi, In the material field of VF04 is not showing anything. What i have done is i goto SE11 -> put VKDFI under database table. Then under component tab, i put in a component MATNR and activate it Goto VF04 -> execute. In the maintain billing due list,