Hello all,

I'm search for persistence method for my application and find OJB !

Reading Help i got this:

public class User {
        private String userName;
        private String userPassword;
 
        public String getUserName() {
                return userName;
        }
        public void setUserName(String userName) {
                this.userName = userName;
        }
        public String getUserPassword() {
                return userPassword;
        }
        public void setUserPassword(String userPassword) {
                this.userPassword = userPassword;
        }
}

and i have the mapping:

<class-descriptor
       class="com.jvs.selene.schema.User"
       table="scht_security_user">
       bla bla bla field-descriptors
</class-descriptor>

But a think in another class. This class have about 50 attributes and a 
change the access method for this attributes using HashMap like this:

public class DataObject {
        private int                             id;
        private char[]                          oid = null;
        private HashMap<String,Object>  map = null;
 
        public DataObject(String oid) {
                this.oid = oid.toCharArray();
                map = new HashMap<String,Object>();
                id = 0;
                oid = "".toCharArray();
        }
 
        public void setAttr(String name, Object value) {
                map.put(name, value);
        }

        public Object getAttr(String name) {
                return map.get(name);
        } 
}

The problem:

In this way, my class have dinamic attributes set. How work with this 
dinamic mapping? I can map Key in the HashMap to field into the table? if 
this Key are new in some cases, the OJB create the correspondent field in 
the table with Key name without any command?

Best regards,

Davi Baldin
Brazil - SP

Reply via email to