storing in entity beans


EJB programming & troubleshooting: storing in entity beans

  1. storing in entity beans (3 messages)


    My question is ... how complex objects can i store in entity beans ? what is the limitation ?

    can i store objects like DEFAULT TABLE MODEL ?

    from what i know ejb specification says that the objects need to be serializable ... but i am not sure if the objects need to be light weight objects like String, Collection etc, or they can be heavy weight components.



    Meka Toka

    Threaded Messages (3)

  2. storing in entity beans[ Go to top ]

    I happened to search the web for the above question and came up with very little info.

    From what i gathered

    --> i must be able to store a default table model(DTM) in an entity bean ... as DTM is serializable.

    But the problem i might be facing is that ... DTM is a complex object and so it will be stored as BLOB in the data base.

    I will loose the handling on that DTM while writing the EJB-QL to describe the deploymeny descriptor.

    Another Solution to do that ::

    store DTM as a seperate entity bean and store the reference to the interface of that bean.


    which is a better solution ...
    (1) Storing the DTM as it is and loosing handling ability
    (2) Storing the DTM as a seperate entity bean and refering it in my main bean

    Thank you

    meka toka
  3. storing in entity beans[ Go to top ]

    J2EE development requires more than the ability to fire up an IDE, you know. Doing it the right way, you should: analyze the process, build a model of it, design a program and then code. That way, you get objects. Your way, starting the other way around, you end up with a Swing DefaultTableModel as an entity.

    Object orientation aside, the database side is not even in the first normal form: a table in a table. Duh.

    I don't understand the difference between option one and two, either.

    Had you analyzed and modelled your process, your model would probably have a master entity (e.g. department) and detail entities associated with it (e.g. courses). On the presentation tier, you would have a table to list the details (courses) for a given master (department) and each *row* in the table would map to a detail entity.

    So, first read about the object oriented paradigm, modelling (and UML) and object-to-relation mapping (Scott Ambler has a good paper on this one, search on Google). You will understand why your web search came up with little info.
  4. storing in entity beans[ Go to top ]

    Ferhat SAVCI ,

    Thank you for the reply, but you totally misunderstood what i wrote.

    In my application i am using EJB just to store data and send back when needed on network.

    Reason why i ended up with a DTM is because, i dont have any work to do with the data present in the DTM. The DTM merely represents a complex object in the main bean.

    Yeah, i could have made another entity bean abd used the reference in my main bean. But, when i am not doing any work on the data contained in data why write another bean ?

    So, if i compare my situation to the example you gave,

      I have a DEPARTMENT entity bean, it contains another bean called COURSES ... but i dont have any work to do with the data in the bean COURSES.

    Then why write another bean ? Wouldnt it be easier to just store the object as serializable and retrieve when needed ?