RE: [JBoss-dev] CMP 2.x Relationships Implementation

2001-06-28 Thread marc fleury


|-Original Message-
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of Dain
|Sundstrom
|Sent: Thursday, June 28, 2001 7:18 PM
|To: '[EMAIL PROTECTED]'
|Subject: [JBoss-dev] CMP 2.x Relationships Implementation
|
|
|Hi all,
|
|I have been working on CMP 2.x relationships and I finally have the
|degenerate monkey case working, one-to-one unidirectional. It is the
|uninteresting case and a monkey could have coded it (of course it took me a
|day and a half). Any way, I started with this case to give me a feeling for
|how difficult the rest of the cases would be, and it helped me identify the
|following problem.
|
|PROBLEM:
|
|In the core of the CMR (Container Managed Relation) field, I have the pk of
|the related entity, and I need to operate on the related entity's
|data. So I
|need the EntityEnterpriseContext (ctx) object for the related (and I only
|have the pk), because all of the data for the entity is stored in
|ctx.getPersistenceContext().  The only way I can find to get a ctx for a pk
|is from EntityInstanceInterceptor, and the only way to get to the
|EntityInstanceInterceptor is container.invoke(mi).

no no no it's in the cache,

container.cache.get(id) (or something like that)

marcf

|PROPOSED SOLUTION:
|
|I will create a new interceptor for relationships. In the CMR code when I
|need to operate on related object's data, I will send a 'message' to the
|related persistence store via the interceptor chain, and the last
|interceptor (mine) will catch the 'message' and have the related
|persistence
|store perform the necessary operation.
|
|PLEASE RESPOND:
|
|If you know of another way to do this or if this is a bad idea,
|please speak
|up now. My understanding of the intricacies of the container is very
|limited, and I'm afraid my proposed solution may create a funky problem for
|the system. Any response would be appreciated (even if it's 'yep that's
|cool').
|
|Thanks,
|
|Dain Sundstrom
|
|___
|Jboss-development mailing list
|[EMAIL PROTECTED]
|http://lists.sourceforge.net/lists/listinfo/jboss-development



___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



RE: [JBoss-dev] CMP 2.x Relationships Implementation

2001-06-28 Thread Dain Sundstrom

 | The only way I can find to get a ctx for a pk
 |is from EntityInstanceInterceptor, and the only way to get to the
 |EntityInstanceInterceptor is container.invoke(mi).
 
 no no no it's in the cache,
 
 container.cache.get(id) (or something like that)
 
 marcf
 

YES! Thanks so much.  I didn't want to write the interceptor.  This is going
to be way easier. I'm going to go code now.

-dain

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



RE: [JBoss-dev] CMP 2.x Relationships Implementation

2001-06-28 Thread Dain Sundstrom

marc,

Do you mean that I should be setting invoked, or something else?

I got the bi-directional one-to-one (enforced integrity) working using the
entity cache, but it gives me a bad feeling.  In the this case, there may be
up to 4 beans that need to be stored:

before:
a1--b1
a2--b2

a1.setB(b2)

after:
a1\ b1
a2 \b2

So, I hold onto up to three other contexts. When my store is called, I write
my state and then store the other contexts (with their respective mangers).
This won't cause extraneous writes as 'tuned updates' is always on.

What is giving me the bad feeling is I have just cut out all of the work
that is being done in the interceptors, specifically
EntitySynchronizationInterceptor. For example, do I need to remove the
context from the cache at the end of the transaction? Do I need to lock the
context? What if one of the beans is removed? (the new remove procedure for
relationships may handle this, but haven't implemented it yet)

As you can tell this has given me a lot of concern. If this is stuff I
shouldn't worry about, good. If I should worry, will it be better to create
the new interceptor, thus reusing the code in the other interceptors, or
will it be easier to handle the few special cases in the persistence store?

-dain

 -Original Message-
 From: marc fleury [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, June 28, 2001 9:53 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [JBoss-dev] CMP 2.x Relationships Implementation
 
 
 also be sure to report right here is you touch any of the 
 information in the
 ctx (using setters)
 
 marcf
 
 |-Original Message-
 |From: [EMAIL PROTECTED]
 |[mailto:[EMAIL PROTECTED]]On 
 Behalf Of Dain
 |Sundstrom
 |Sent: Thursday, June 28, 2001 9:45 PM
 |To: '[EMAIL PROTECTED]'
 |Subject: RE: [JBoss-dev] CMP 2.x Relationships Implementation
 |
 |
 | | The only way I can find to get a ctx for a pk
 | |is from EntityInstanceInterceptor, and the only way to get to the
 | |EntityInstanceInterceptor is container.invoke(mi).
 |
 | no no no it's in the cache,
 |
 | container.cache.get(id) (or something like that)
 |
 | marcf
 |
 |
 |YES! Thanks so much.  I didn't want to write the interceptor.
 |This is going
 |to be way easier. I'm going to go code now.
 |
 |-dain
 |
 |___
 |Jboss-development mailing list
 |[EMAIL PROTECTED]
 |http://lists.sourceforge.net/lists/listinfo/jboss-development
 
 
 
 ___
 Jboss-development mailing list
 [EMAIL PROTECTED]
 http://lists.sourceforge.net/lists/listinfo/jboss-development
 

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development