ejb design problem, can Proxy solve it?

Discussions

EJB design: ejb design problem, can Proxy solve it?

  1. ejb design problem, can Proxy solve it? (3 messages)

    Hello EJB design gurus!

    I have a XML content that represent a job description (from here on I'll call that a position). This position will be stored in a RDBMS in a CLOB column. The XML will contain a job title, duties, and some other job related entities. This position can be very bulky (in some cases it can reach a size of 100K or more)! On the client side, users will be able to open an existing position and edit it (add new entities, remove or edit existing ones). I am using a three tier architecture based on a RDBMS, an application server and web browser clients.

    Here's my problem. I will use a Position value object. This is based on the XML CLOB column. I'll have a reader which will read the XML content and construct a Position value object from it. This Position object contains nested composite objects. Every time a user changes an entity (e.g., a duty description) in a position, the whole Position value object will have to travel across the network from the server to the client just for a simple update. While this seems to be ok, as the position grows larger, this can cause a signifficant delay.

    This lead me to the conclusion that I have to find a better way to do this - some kind of light-weight object traveling across the wire and at the point when we want to save the changed position, we merge the light-weight position with the existing large sized position.

    I was thinking that maybe the Proxy design pattern can be useful for solving this particular problem? What is your opinion on this problem? Thanks in advance!

    Georgi
  2. Tell us more about your Proxy pattern, how do you intend to solve the problem of transfering huge amount of information to/from the server. Your definition of Proxy might mean different things to what I'm thinking of.
  3. Hi,

    I am thinking of using a light-weight analog of the Position object (the PositionProxy). This PositionProxy will have the same interface as Position and in addition it will reference a PositionManager which will take care of the Position persistence. So this PositionProxy ejb will initially provide an "empty" Position value object. Then, from the client we'll gradually build a Position using the proxy. Once we are done, we should read the existing Position (using the PositionManager) and merge it with the lightweight version (held in the PositionProxy) and save it back to the storage.

    Georgi
  4. Hi,

    I am thinking of using a light-weight analog of the Position object (the PositionProxy). This PositionProxy will have the same interface as Position and in addition it will reference a PositionManager which will take care of the Position persistence. So this PositionProxy ejb will initially provide an "empty" Position value object. Then, from the client we'll gradually build a Position using the proxy. Once we are done, we should read the existing Position (using the PositionManager) and merge it with the lightweight version (held in the PositionProxy) and save it back to the storage.

    Georgi