[JBoss-dev] CMP 2.x Persistence Store

2001-06-23 Thread Dain Sundstrom

Hi,

I just committed the initial revision of the CMP 2.x persistence store. I
started working on this on the plane back from Java One, and have been
coding it for the past two weeks. The code I have committed represents the
completion of the first phase of this project.  I have broken this project
into the following four phases:

1. 2.x CMP fields - complete
2. Relationships - July 7
3. EJB-QL - July 21
4. Verifier, cleanup and final docs - August 4

Here is what I already have working:

CMP 2.x abstract accessors
Tuned updates (now always on)
Configurable eager loading
Lazy load groups
Read-only columns
Dependent value classes 

All of the existing features should still work and the engine is backward
compatible with CMP 1.x, as is required by the specification. 

I don't have the new preloading finder code merged yet, but it is not really
important now because I'll probably have to restructure the query code
anyway in phase 3.

I'll follow-up with a message tomorrow, detailing how you can configure the
new stuff.

Dain Sundstrom

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



[JBoss-dev] How can I convert a pk into an entity?

2001-06-23 Thread Dain Sundstrom

Hi,

I have been designing the Container Managed Relationships, and have run into
one problem; I can't seem to figure out how to turn a primary key for an
entity into the entity (local or remote).

Here is what I envision happening. The bean code, say OrderBean, calls
getLineItems(). My cmp dynamic proxy gets this message, I query the database
and create a set (or collection) of LineItem primary keys.  At this point, I
need a to convert these PKs into local interfaces (but remote will work for
now), so I can return them back to the OrderBean code. Note, this happens
inside of the bean code and not over the remote interface.

I read over the finder code and it appears that the container invoker
handles the conversion of a PK into a bean.

Do I just need to call getEntityCollection on the container invoker?

Is it safe to do this? 

Am I at risk of creating a dead lock?


thanks

-dain

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



Re: [JBoss-dev] JAWS -Single Datasource

2001-06-25 Thread Dain Sundstrom

I'm going to check this out in a couple of hours.

I did some more thinking about this last night before I went to sleep.  I
don't think this willl be a problem for single beans or relationships
between beans acrost data sources, other then not beening able to use
foreign keys to enforce refrencial integerity at the db level.  The only
problem is that you will not be able to use ejb-ql acrost data sources.
Which meens that when I write the ejb-ql engine I need to verify that all
beans in the query come from the same data source.

This shouldn't be a problem,

-dain

- Original Message -
From: marc fleury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 9:30 AM
Subject: RE: [JBoss-dev] JAWS -Single Datasource


 |Nonetheless, it would be great if the new CMP stuff will be able to
 |support multiple datasources i.e. move the datasource from a JAWS file
 |level node to a bean level value.

 I should really add a slide in the training called scratch your own itch,
 Open Source's dirty little secret...

 You want it? bad?

 You know what to do

 marcf

 |
 |Thanks
 |
 |Vinay
 |
 |marc fleury wrote:
 |
 | Not all configuration cases will uses transactions across different
 | databases (i.e. really require XA synchronization).
 |
 | The case Vinay is talking about is fairly simple simple 2 beans,
 |2 different
 | apps (they don't talk to each other so no transaction enrollment), 2
 | different databases, which is a perfectly valid approach to web
container
 | app design, in fact a smart way to handle the database access
 |from your web
 | layers ( and teh real reason I suspect he is asking for this feature).
 |
 | Distributed transaction is another ball game altogether, but what he is
 | asking for doesn't necessarily require that.  Also he has been through
my
 | training and he knows that distributed transactions are bad mkey?
 |
 | In short it is a very valid feature Vinay, as everyone told you (dain,
 | danch), why don't you go ahead and hack the metadata code to
 |make sure you
 | can support multiple datasources (I am surprised it is not there yet).
 |
 | Talk to sebastien if you need help on that code, he wrote it.
 |
 | regards
 | marcf
 |
 | |-Original Message-
 | |From: [EMAIL PROTECTED]
 | |[mailto:[EMAIL PROTECTED]]On Behalf Of
danch
 | |Sent: Sunday, June 24, 2001 11:58 PM
 | |To: [EMAIL PROTECTED]
 | |Subject: Re: [JBoss-dev] JAWS -Single Datasource
 | |
 | |
 | |Dain Sundstrom wrote:
 | |
 | | No reason to tie an entire jar to a single datasource.  I'll
 | |check my code
 | | to see if it can support multiple datasources, although I
 |don't think it
 | | will work with most DBs.  This would require the DBs to
 |natively support
 | | JDBC 2.0 XA transactions, and if I remember most DBs don't
 |have 2-phase
 | | commit drivers yet.
 | |
 | | -dain
 | |
 | |I believe they are getting much closer (at least if implementations of
 | |the XA extensions to JDBC are a true indicator). Of course, many of
the
 | |XA implementations are broken in incompatible ways.
 | |
 | |Also, this wouldn't matter so long as the beans that are in different
 | |databases are in different transactions. But then there'd be no reason
 | |not to split them into different ejb-jar files.
 | |
 | |-danch
 | |
 | |
 | |___
 | |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



 ___
 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] zombie thread- bug

2001-06-25 Thread Dain Sundstrom

I don't know if this helps but you can always call inerrupt() on the thread.
This causes the thread to throw an InterruptedException.  Which will cause
most code to exit unless they catch Exception in the main loop and restart.

-dain

- Original Message -
From: Peter Fagerlund [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 6:32 AM
Subject: Re: [JBoss-dev] zombie thread- bug


 on 1-06-25 08.27, marc fleury at [EMAIL PROTECTED] wrote:
  it seems two processes, webserver (dynaserver) and hypersonicSQL do not
  close properly on Linux and don't really close their threads like it
they
  are supposed to.

 Do the shutdownhook get installed ? (on Linux (VM ?)) - and jmx is
calling
 stopService() in the hsql MBean ???

  That is usually due to the fact that thread.destroy is not implemented
and
  it is recommended to set a flag in your code to properly shut down the
  thread.

 I do not understand ! ? well the serverSocket is started - maybe add them
 into a threadGroup that gets teared down ??? since the other threads seem
to
 get cleared alltho i suspect the shutdownhook is not installed ...

 ahhh - kill pid and have a threadGroup for the SS'ets ! ?

  in any case it is a bug in both dynaserver and hypersonic :(

 oki if the MBean.stopServer gets called then its a bug in those services
 otherwise it has to do with the linux vm and the way the shutdownhook is
 implemented ... do i recall a earlier post on this ??? ... I do not know
 since I do nothave a unified search - but have now serched in 3 places on
 the web user/dev/manual ... and some are there ...

 /peter


 ___
 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] zombie thread- bug

2001-06-25 Thread Dain Sundstrom

You call interrupt on the thread object in the vm. As I said, I don't know
if I am helping

-dain

- Original Message -
From: Peter Fagerlund [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 11:49 AM
Subject: Re: [JBoss-dev] zombie thread- bug


 on 1-06-25 18.26, Dain Sundstrom at [EMAIL PROTECTED] wrote:

  I don't know if this helps but you can always call inerrupt() on the
thread.
  This causes the thread to throw an InterruptedException.  Which will
cause
  most code to exit unless they catch Exception in the main loop and
restart.

 Where would one call that ? when a pid is issued ??? anybody know ? ...
also
 - so it does not conflicts with the Ctrl-c ... mayby a shutdown shell
script
 instead ??? ... closing the 2 ServerSockets and then kill pid ? ...

 /peter


 ___
 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] High load...

2001-06-25 Thread Dain Sundstrom

  I'm just curious what was the passivation cache for?
 


 Memory management. If your database contains 10 GB and you only have 1GB
 of memory, you'll need to swap out some bean based on some criteria (LRU
 by default) to make room.


 -danch


Exactly, so what was the passivation cache?  During passivation we want to
dump data to make room for new objects.  I think I'm lost... Why would we
want to cache objects that we are tring to remove from memory?

-dain


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



Re: The next generation GUI (was : Re: [JBoss-dev] EJX and XML)

2001-06-25 Thread Dain Sundstrom

Dude, GUI tools suck. Just edit the xml by hand. IMO if a person can't edit
xml they shouldn't be configuring the server or ejb-jar.

-dain

- Original Message -
From: Jay Walters [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 25, 2001 2:42 PM
Subject: RE: The next generation GUI (was : Re: [JBoss-dev] EJX and XML)


 netbeans is another possibility...

 -Original Message-
 From: Peter Fagerlund [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 25, 2001 3:36 PM
 To: [EMAIL PROTECTED]
 Subject: The next generation GUI (was : Re: [JBoss-dev] EJX and XML)


 on 1-06-25 19.30, marc fleury at [EMAIL PROTECTED] wrote:

  The next generation GUI

 Could be built using a set of extension to a freeware shell like the
 Together Community Edition 5.0
 http://www.togethercommunity.com/community-edition.shtml
 or some other free tool with easy yet powerfull plugin capability ...
 couse it gives direct down and into the func of the tool ...

 So :

 What is the spec for the tool ? ...
 What is the wishlist for the tool ? ...

 I am not commiting here just curious to understand what it absolutely has
to
 do -- also what it could be made up in dreams to do ... ex. rollover
logs -
 collect statistics - fail/load notifications etc. ? ... besides conf ! ?
...

 skin'able ? ...

  ;-)

 /peter



 ___
 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



RE: [JBoss-dev] High load...

2001-06-25 Thread Dain Sundstrom

 I'm just curious what was the passivation cache for?
 
 
 
 Memory management. If your database contains 10 GB and you 
 only have 1GB
 of memory, you'll need to swap out some bean based on some 
 criteria (LRU
 by default) to make room.
 
 
 -danch
 
 
  
  Exactly, so what was the passivation cache?  During 
 passivation we want to
  dump data to make room for new objects.  I think I'm 
 lost... Why would we
  want to cache objects that we are tiring to remove from memory?
  
  -dain
 
 It's a cache that passivates when it has over a certain 
 number of object 
 within it. It doesn't passivate what it's trying to cache, it 
 passivates 
 the overage.
 

So if we remove the passivation cache, do we loose commit Option A? If not,
how do we keep bean data alive while passivated?

I still may not understand this.

-dain

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



RE: The next generation GUI (was : Re: [JBoss-dev] EJX and XML)

2001-06-25 Thread Dain Sundstrom

I was just picking a fight :)

I agree. I hate admining servers and like GUI tools instead weird property
files.  But, you do have to agree that the xml configuration that JBoss uses
is simple enough for most admins to figure out (especially when compared to
Linux startup scripts or apache conf).

I definitely think some one could make some bucks on this project, as the
people with the bucks tend to like GUI tools.

-dain

 -Original Message-
 From: Schaefer, Andreas [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 25, 2001 3:51 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: The next generation GUI (was : Re: [JBoss-dev] 
 EJX and XML)
 
 
 Oh man
 
 How short sighted you are. I aggree when you are a J2EE
 programmer then you don't need a GUI but the most future
 administrator of JBoss don't know J2EE well enough to do
 so.
 And also a management GUI is not only to configure a server
 but also to administer the EJBs, redeploy, restart Services,
 add new Servcies (DataSources) etc.
 
 Finally when you have a look at the success of M$ then you
 see that convinience matters.
 
 Andy
 
  -Original Message-
  From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
  Sent: Monday, June 25, 2001 1:27 PM
  To: [EMAIL PROTECTED]
  Subject: Re: The next generation GUI (was : Re: [JBoss-dev] 
  EJX and XML)
  
  
  Dude, GUI tools suck. Just edit the xml by hand. IMO if a 
  person can't edit
  xml they shouldn't be configuring the server or ejb-jar.
  
  -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-dev] CMP 2.x Quick How-to

2001-06-25 Thread Dain Sundstrom
 on the entity element, so it should be
self-explanatory.

When the manager encounters a field that has the type of a specified DVC, it
will persist this field to the columns specified. DVCs can be constructed
from other DVCs, so when the manager runs into a DVC it flattens it into a
set of columns. If the manager finds a DVC circuit, it will throw an
EJBException. Property mappings can be overridden in the entity element as
follows:

entity
 name-nameCustomerBean/name-name
 table-nameCUSTOMER/table-name
 cmp-field
  field-nameuserId/field-name
  column-nameUSER_ID/column-name
 /cmp-field
 cmp-field
  field-namecreditCard/field-name
  column-nameCREDIT_CARD/column-name
  property
   property-namecardNumber/property-name
   column-nameCC_NUM/column-name
   jdbc-typeVARCHAR/jdbc-type
   sql-typeVARCHAR(20)/sql-type
  /property
  property
   property-namebillingAddress.line1/property-name
   column-nameADDRESS_LINE1/column-name
  /property
 /cmp-field
/entity

Pretty simple right?  The only thing to note is the billingAddress.line1.
When overriding property info in the entity, you need to refer to the
property from a flat perspective.

6. Finder specification:  I have changed the specification of finders to
bring them more in line with ejb-ql.  Here is an example finder:


query
 descriptionSearch all fields in cd/description
 query-method
  method-namefindInAnyField/method-name
  method-params
   method-paramjava.lang.String/method-param
  /method-params
 /query-method
 declared-sql
  whereTITLE={0} OR ARTIST={0} OR TYPE={0} OR NOTES={0}/where
 /declared-sql
/query


The query-method element is right out of the EJB 2.0 spec. The
declared-sql element is similar to jaws finder element, except I have
broken the query element into from and where. I also support order as jaws
did.  The new code doesn't have the new pre-load logic, but I will add
something similar in phase 3, where I'll add ejb-ql support.



I hope someone tries the new cmp code, as I haven't had time to do a
complete test.  I have a limited unit test that I can send anyone interested
(just send me a personal email). I will write a complete test in phase 4.

If you find any bugs or would like to request a feature, please email me. I
will fix bugs as they are discovered, and feature req1uests I will
definitely think over.

Dain Sundstrom



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



Re: [JBoss-dev] High load...

2001-06-25 Thread Dain Sundstrom

 
  So if we remove the passivation cache, do we loose commit Option A? If
not,
  how do we keep bean data alive while passivated?
 
  I still may not understand this.


 I think Mark is just suggesting losing the passivation part of the
 cache. The cache we keep, it just keeps growing and growing and growing.


 -danch


I find that hard to believe. Would we reboot the server to cear the cache? I
thought he was suggesting removing the cache and just passivating the beans.
I don't want to put words into marc's mouth so hopefully he will expand on
his suggestion.



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



Re: [JBoss-dev] CMP 2.x Quick How-to

2001-06-25 Thread Dain Sundstrom



 Dain,

 I've read your email on how to use the eager/lazy loading features.  I'm
not
 sure if this is the same thing as danch's read-ahead feature.  Your
 eager/lazy loading seems to be focused around LoadEntity, where danch's
 read-ahead happens on the finder call itself.  I really should examine
your
 code(sorry, too lazy at the moment), but eager/lazy loading seems to
 optimize on limiting what field you load from the database, where danch's
 read-ahead deals with when do you read a beans fields.  With read-ahead
 there is no longer n + 1 select calls when doing a finder call then
 subsequently accessing the beans returned by the finder.  Do your
 optimizations take this into account?


I have not included the pre-load logic that dan wrote read-ahead.  I will
look into this when I write the EJB-QL code.  With read ahead you load all
the rows of the data with one select statement (maybe two...).  The
eager/lazy loading allows you to return a bean to the code with only some of
the data loaded (some of the columns).  This allows you to always load the
most common data and go back to the database when less common data is
accessed. Think of an entity with 500+ columns of data. I've seen it. It is
very common in HealthCare and Finance applications. Most of the time you
only need 20 columns of data, but in CMP 1.x you had to load all 500.  With
abstract accessors in CMP 2.x you only load what you need.

When I write the EJB-QL code, in a couple of weeks, I plan on supporting
eager-loading per query and read-ahead (per dan's example). This will allows
us to delcare which rows and columns to load.

-dain


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



Re: [JBoss-dev] High load...

2001-06-26 Thread Dain Sundstrom

 we would have to implement the transaction isolation levels correctly in
 jboss again I believe that lives at the jbossCMP level.  But if we are
going
 to support different vendors for the CMP engines we must take this part
out
 or at least offer a common API... hmmm must think about it.


I added transaction isolation to the new cmp plugin. You can set it by
adding the  transaction-isolation element after the datasource element.
Valid levels are:
transaction-none
transaction-read-committed
transaction-read-uncommitted
transaction-repeatable-read
transaction-serializable

Give me 10 minutes and I'll add it to JAWS...

I don't know if you wanted with user configurable, but for now it will allow
you to play with different levels.  I can make it static later.

-dain



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



Re: [JBoss-dev] High load...

2001-06-26 Thread Dain Sundstrom

 
  I don't know if you wanted with user configurable, but for now it will
allow
  you to play with different levels.  I can make it static later.
 


 static?

fixed


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



Fw: [JBoss-dev] Shouldn't expose transaction-isolation within CMP

2001-06-26 Thread Dain Sundstrom

Sorry, didn't get to to line right on this message, and it only went to
marc... read below...

-dain

- Original Message -
From: Dain Sundstrom [EMAIL PROTECTED]
To: marc fleury [EMAIL PROTECTED]
Sent: Tuesday, June 26, 2001 2:24 PM
Subject: Re: [JBoss-dev] Shouldn't expose transaction-isolation within CMP


  |Please correct me if I'm wrong(I seem to be wrong about 50% of the
  |time :-),
  |but, I really don't think you should expose transaction-isolation
levels
  |within CMP or in the definition of entities.  This really belongs in
the
  |creation of the connection pool.  CMP cannot really guarantee that a
  |connection will not be shared between different entity types
  |within the same
  |transaction that use the same connection pool.  Actually, I'm pretty
sure
 
  which is why I am asking if the jdbc drivers support reconfiguration of
 the
  isolation level on the fly or is it pretty much a constructor thingy.
 
  btw if it is the good case (we can change it) then it is not up to
minerva
  to do this, all minerva does is hand out the connection but it is up to
a
  functional unit above it, one aware of the application accessing this
  connection.  That would live in JCA, but it would need to know the
  applciation context, or it would purely live in the app server sphere
 (i.e.
  jaws getting the connection, or asking the container to do it on its
 behalf,
  whatever we can do that call somewhere, factored or not).
 
  am i making sense?
 

 I think I understand now.  Here is some text I found the  J2EE tutorial:

 
 You cannot modify the isolation level of a entity beans with
 container-managed persistence. These beans use the default isolation level
 of the DBMS, which is usually READ_COMMITTED.  For entity beans with
 bean-managed persistence and for all session beans, you can set the
 isolation level programmatically with the API provided by the underlying
 DBMS. A DBMS, for example, might allow you to permit uncommitted reads by
 invoking the setTransactionIsolation method:

 Connection con;
 ...
 con.setTransactionIsolation(TRANSACTION_READ_UNCOMMITTED);

 Do not change the isolation level in the middle of a transaction. Usually,
 such a change causes the DBMS software to issue an implicit commit.
Because
 the isolation levels offered by DBMS vendors may vary, you should check
the
 DBMS documentation for more information.
 ---

 So the code I added probably causes an implicit commit,  which is bad.
 From my very JDBC centric perspective, this should be set in Minerva
 (JBossPool?) and user configurable. I don't know much about the connector
 architecture, so maybe Minerva is the wrong place.

 Any way, I think I should roll back my change. If you agree marc, just say
 so and it is done.

 I don't know any thing about Minerva, so if you want that changed, someone
 else would be better suited.  If no one wants to do it, I'll look at it.

 -dain



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



Re: [JBoss-dev] Shouldn't expose transaction-isolation within CMP

2001-06-26 Thread Dain Sundstrom

All of this is covered in detail in section 17.3.2 of the EJB 2.0 spec.  I
think everyone should take a secound and read it (it is only three
paragraphs).

-dain

- Original Message -
From: Bill Burke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 26, 2001 2:52 PM
Subject: RE: [JBoss-dev] Shouldn't expose transaction-isolation within CMP




  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of marc
  fleury
  Sent: Tuesday, June 26, 2001 3:05 PM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: RE: [JBoss-dev] Shouldn't expose transaction-isolation within
  CMP
 
 
  |Please correct me if I'm wrong(I seem to be wrong about 50% of the
  |time :-),
  |but, I really don't think you should expose transaction-isolation
levels
  |within CMP or in the definition of entities.  This really belongs in
the
  |creation of the connection pool.  CMP cannot really guarantee that a
  |connection will not be shared between different entity types
  |within the same
  |transaction that use the same connection pool.  Actually, I'm pretty
sure
 
  which is why I am asking if the jdbc drivers support
  reconfiguration of the
  isolation level on the fly or is it pretty much a constructor thingy.
 
  btw if it is the good case (we can change it) then it is not up to
minerva
  to do this, all minerva does is hand out the connection but it is up to
a
  functional unit above it, one aware of the application accessing this
  connection.  That would live in JCA, but it would need to know the
  applciation context, or it would purely live in the app server
  sphere (i.e.
  jaws getting the connection, or asking the container to do it on
  its behalf,
  whatever we can do that call somewhere, factored or not).
 
  am i making sense?
 

 Danch wrote:
 
  It's on the fly, but it (generally) has to be set at the beginning of
  the transaction only.
 

 So the isolation flag should really be taken out of Dain's stuff?  Again,
I
 humbly recommend moving the transaction-isolation level to the definition
of
 the connection pool until a better abstraction(JCA? I know jack squat
about
 it..) is implemented.  With that, you can attach the Entity to the
 connection pool configured to your liking.

 Bill



 ___
 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] High load...

2001-06-26 Thread Dain Sundstrom

 I don't know if you wanted with user configurable, but for now it will
 
  allow
 
 you to play with different levels.  I can make it static later.
 
 
 
 static?
 
 
  fixed
 

 Like at compile time, literally 'static' in the java sense static?
 Please god, not this again.

 Remember that the people responsible for care and feeding of JBoss
 server instances are liable to be system administrators who have just
 about 0 regard for products that require a recompile just to change a
 setting. Consider all the neat stuff you can change by catting some
 value into a psuedo-file under /proc on a linux box. Consider the things
 people bitch about _not_ being able to change there (per-user process
 limit, etc.).

Relax dan, I was implying that if we needed to only support one isolation
level, because of a cache configuration, I can remove the user-configurable
part and set it to always be one isolation level.  This is all moot because
I think I will be rolling back the change (read my other message).

-dain


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



Re: [JBoss-dev] Shouldn't expose transaction-isolation within CMP

2001-06-26 Thread Dain Sundstrom

|Please correct me if I'm wrong(I seem to be wrong about 50% of the
|time :-),
|but, I really don't think you should expose transaction-isolation
  levels
|within CMP or in the definition of entities.  This really belongs
in
  the
|creation of the connection pool.  CMP cannot really guarantee that
a
|connection will not be shared between different entity types
|within the same
|transaction that use the same connection pool.  Actually, I'm
pretty
  sure
   
which is why I am asking if the jdbc drivers support
  reconfiguration of
   the
isolation level on the fly or is it pretty much a
  constructor thingy.
   
btw if it is the good case (we can change it) then it is not up to
  minerva
to do this, all minerva does is hand out the connection but
  it is up to
  a
functional unit above it, one aware of the application accessing
this
connection.  That would live in JCA, but it would need to know the
applciation context, or it would purely live in the app server
sphere
   (i.e.
jaws getting the connection, or asking the container to do it on its
   behalf,
whatever we can do that call somewhere, factored or not).
   
am i making sense?
   
  
   I think I understand now.  Here is some text I found the  J2EE
tutorial:
  
   
   You cannot modify the isolation level of a entity beans with
   container-managed persistence. These beans use the default
  isolation level
   of the DBMS, which is usually READ_COMMITTED.  For entity beans with
   bean-managed persistence and for all session beans, you can set the
   isolation level programmatically with the API provided by the
underlying
   DBMS. A DBMS, for example, might allow you to permit
  uncommitted reads by
   invoking the setTransactionIsolation method:
  
   Connection con;
   ...
   con.setTransactionIsolation(TRANSACTION_READ_UNCOMMITTED);
  
   Do not change the isolation level in the middle of a
  transaction. Usually,
   such a change causes the DBMS software to issue an implicit commit.
  Because
   the isolation levels offered by DBMS vendors may vary, you should
check
  the
   DBMS documentation for more information.
   ---
  
   So the code I added probably causes an implicit commit,  which is
bad.
   From my very JDBC centric perspective, this should be set in Minerva
   (JBossPool?) and user configurable. I don't know much about the
  connector
   architecture, so maybe Minerva is the wrong place.
  
   Any way, I think I should roll back my change. If you agree
  marc, just say
   so and it is done.
  
   I don't know any thing about Minerva, so if you want that
  changed, someone
   else would be better suited.  If no one wants to do it, I'll look at
it.
  
   -dain
  
 

 I know what to do for Minerva(aka org.jboss.pool.jdbc, correct?) and can
put
 these changes in.  But I really wouldn't know what to do with JCA, that
is,
 if a change is required there as well.

 Bill


I agree.  IMHO we should move this to minerva and roll back my code.  With
the implicit comit junk, I don't think there is any other option.  If JCA
person is watching this thread, please pipe up and what you would like to
see.

Any way I will roll it back in an hour or so.

-dain

BTW. Section 17.3.2 of the EJB 2.0 spec says, For session beans and
message-driven beans with bean-managed transaction demarcation, the Bean
Provider can specify the desirable isolation level programmatically in the
enterprise bean's methods, using the resource-manager specific API. For
example, the Bean Provider can use the
java.sql.Connection.setTransactionIsolation(...) method to set the
appropriate isolation level for database access.  I don't know if a BMT
gets a 'virgin' connection from minerva, but if it doesn't we could get
implict commits.


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



Re: [JBoss-dev] High load...

2001-06-26 Thread Dain Sundstrom

I think you missed one of the old messages (way to many today).

It appears that if you changes the transaction isolation in the middle of a
transaction the driver can perform an implicit commit (YUCK).

So, I don't think we can trust drivers to allows us to change the level on
the fly.

-dain
- Original Message -
From: marc fleury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 26, 2001 10:36 PM
Subject: RE: [JBoss-dev] High load...


 | Sure, it would be useful to be able to specify different levels per
 | bean, but given the apparent constraints that the databases are putting
 | us under, implementing it against the database isn't feasable.
 |
 |
 |Just use a freakin' different connection pool for different beans and
there
 |is no freakin' database constraint.

 oh wait reading old stuff, so you are saying that

 (do jdbc connection support setIsolationlevel on the fly) == false

 shit...

 databases is an UGLY world, you know what??? we can do MUCH better at the
 distributed cache level so screw delegating to the db...

 I am drunk and it is getting tough to think ...

 marcf



 ___
 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] CVS update: jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc JDBCCommand.java

2001-06-27 Thread Dain Sundstrom

 we are discussing exactly the opposite, I am deeply convinced that this
 belongs in jaws

 marcf

Sorry, I rolled back the code before you responded.  If you want me to put
it back in, I will it takes about 10 minutes.  I think I made a mistake and
made the first change to quick (it was easy) , and I think we need to figure
out what we are doing (design before code).

-dain


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



[JBoss-dev] CMP 2.x Relationships Implementation

2001-06-28 Thread Dain Sundstrom

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).

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



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



RE: [JBoss-dev] Where is everyone today?

2001-06-29 Thread Dain Sundstrom

Bill,

Thanks for the reply.  I really need other people thinking about this,
because I don't understand the rest of the container.

Here's the deal.  I delegate the actual storage of the other updated
contexts to the their respective persistence storage managers, so they get
stored by correct data source.  I also get references to the other beans
through their container's cache. 

I think the biggest problem with this implementation is that my persistence
store is directly calling store on other persistence stores, thus by passing
all of the code that is supposed know the right way to do this.

Again, I don't know if I'm doing something wrong.  I could post the section
of code that does this, if it will help.

-dain

 -Original Message-
 From: Bill Burke [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 29, 2001 1:53 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [JBoss-dev] Where is everyone today?
 
 
 Yo Dain,
 
 I know absolutely nothing about CMP 2.x Relationships, but it makes me
 really worried that you are working directly with 
 EntityEnterpriseContexts
 from the container.cache.  Why aren't you going through the 
 HOME interfaces
 to access related beans?  Remember, each entity type can have entirely
 different datastores, caching mechanisms, locking mechanisms,
 synchronization mechanisms, and pooling mechanisms.  You 
 shouldn't really be
 circumventing how to access a bean.  If I'm totally out of my 
 league here,
 I'll just apologize and shut up.  Let me know, but in the 
 meantime, I'll try
 to review the CMP 2.x Relationships.
 
 Bill
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On 
 Behalf Of Dain
  Sundstrom
  Sent: Friday, June 29, 2001 2:22 PM
  To: '[EMAIL PROTECTED]'
  Subject: [JBoss-dev] Where is everyone today?
 
 
  Is everyone on vacation? Is the list working? What-ever, 
 doesn't really
  matter.
 
  If any one is around today, and can reply to my message, I 
 would greatly
  appreciate it. I kind of need some guidance on the decision 
 to create an
  interceptor or not.  I'm going to continue along the line that I
  don't need
  an interceptor (I can always add it later).
 
  If you all are on vacation, have a great time.
 
  -dain
 
   -Original Message-
   From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, June 28, 2001 11:48 PM
   To: '[EMAIL PROTECTED]'
   Subject: RE: [JBoss-dev] CMP 2.x Relationships Implementation
  
  
   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

RE: [JBoss-dev] FW: [JBoss-user] Strange Behavior When DataSource goes down.

2001-06-30 Thread Dain Sundstrom

Sounds like a pretty duh request.  Maybe Bill can add this when he is adding
the isolation level code.

-dain

 -Original Message-
 From: danch [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, June 30, 2001 12:03 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [JBoss-dev] FW: [JBoss-user] Strange Behavior When
 DataSource goes down.
 
 
 I tend to agree with Doug on this. Also, I think it's reasonable that 
 the pools be able to tell the difference between inability to 
 create a 
 new object (connection, in this case) and simple pool exhaustion - 
 there's no reason to block startup of the whole server just 
 because one 
 datasource is bad - you could be taking 20 applications down just 
 because 1 has a database that went down. This like inability 
 to connect 
 should also be logged at error level.
 
 If nobody objects, I'll take this on and add this feature for 3.0.
 
 -danch.
 
 Ferguson, Doug wrote:
 
   Hi,
  
  This is a thread that I think needs to move to DEV...
  
  Basically I feel that it is a royal pain that jboss hangs 
 whenever I try to
  startup jboss when a datbase is down and I've set the mbean 
 to blocking. 
  
  I would like to see a timeout feature to where I can setup 
 the mbean with a
  timeout parameter for the blocking. I would also be nice to 
 have a default
  timeout.
  
  Other people brought up interesting issues... Please check 
 the thread.
  
  Thanks,
  d.
  
  -Original Message-
  From: Kaseman, Mark T
  To: '[EMAIL PROTECTED]'
  Sent: 6/29/2001 11:40 AM
  Subject: RE: [JBoss-user] Strange Behavior When DataSource 
 goes down.
  
  Number 2 is a big issue for me and OS/390 DB2. DB2 has an 
 idle thread
  time
  out parameter, that causes the datasource to become 
 unusable once DB2
  kills
  the inactive connection/thread. I then must reboot JBOSS. 
 Orion server
  recovers the connection with no problem.
  
  -Original Message-
  From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]]
  Sent: Friday, June 29, 2001 12:11 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [JBoss-user] Strange Behavior When DataSource 
 goes down.
  
  
  In this case, no query has been executed.
  
  What I'd change:
  1. In the pools, object factory create methods should throw 
 an exception
  
  when they can't create an object - this way we can tell 
 pool exhaustion 
  from inability to create a pooled resource.
  2. The pools should have an ability to test connections to 
 determine if 
  they're still good (configurable, of course). This is for 
 those whose 
  database thwacks them on the head after some period of time (and no 
  ability to turn that behavior off)
  
  others?
  
  -danch
  
  
  David Jencks wrote:
  
  
  Well, I kind of agree, however I don't know how to 
 distinguish between
  
  the
  
  db crashing and executing a query whose first results are 
 available in
  
  3
  
  hours...and you're willing to wait.  I think if the driver can
  
  distinguish
  
  and throw an exception, you get to see the exception.  
 Otherwise, what
  
  do
  
  you do?  Some kind of time awareness such as jini leases would be
  
  nice,
  
  however there certainly isn't any support for them in jdbc.  Any
  
  ideas?
  
  david jencks
  
  On 2001.06.28 15:32:20 -0400 Richard Kasperowski wrote:
  
  
  David Jencks wrote:
  
  
  
  Hi,
  I find it hard to understand what you want.
  
  jboss does try out connections from configured datasources on
  
  startup,
  
  and
  
  
  hangs if they can't connect.
  
  I don't see how this is a severe problem: if your 
 datasource isn't
  
  
  working,
  
  
  neither will your app.
  
  
  When a datasource becomes unavailable after startup, it might be 
  desirable for the application to tell the user, sorry, 
 the database
  
  is 
  
  unavailable.?   A user might find that more satisfactory 
 than being 
  denied service.
  
  
   
  
  
  
  ___
  JBoss-user mailing list
  [EMAIL PROTECTED]
  http://lists.sourceforge.net/lists/listinfo/jboss-user
  
  ___
  JBoss-user mailing list
  [EMAIL PROTECTED]
  http://lists.sourceforge.net/lists/listinfo/jboss-user
  
  ___
  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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/metadata RelationshipRoleMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 13:49:00

  Added:   src/main/org/jboss/metadata RelationshipRoleMetaData.java
  Log:
  Represents one ejb-relationship-role element found in the ejb-jar.xml
  file's ejb-relation elements.
  
  Revision  ChangesPath
  1.1  jboss/src/main/org/jboss/metadata/RelationshipRoleMetaData.java
  
  Index: RelationshipRoleMetaData.java
  ===
  /*
   * JBoss, the OpenSource EJB server
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.metadata;
  
  import org.w3c.dom.Element;
  import org.jboss.ejb.DeploymentException;
  
  /** 
   * Represents one ejb-relationship-role element found in the ejb-jar.xml
   * file's ejb-relation elements.
   *
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   * @version $Revision: 1.1 $
   */
  public class RelationshipRoleMetaData extends MetaData {
// one is one
private static int ONE = 1;
// and two is many :)
private static int MANY = 2;

/**
 * Role name
 */
private String relationshipRoleName;

/**
 * Multiplicity of role, ONE or MANY.
 */
private int multiplicity;

/**
 * Should this entity be deleted when related entity is deleted.
 */
private boolean cascadeDelete;

/**
 * Name of the entity that has this role.
 */
private String entityName;

/**
 * Name of the entity's cmr field for this role.
 */
private String cmrFieldName;

/**
 * Type of the cmr field (i.e., collection or set)
 */
private String cmrFieldType;
  
/**
 * Gets the relationship role name
 */
public String getRelationshipRoleName() {
return relationshipRoleName;
}
  
/**
 * Checks if the multiplicity is one.
 */
public boolean isMultiplicityOne() {
return multiplicity == ONE;
}

/**
 * Checks if the multiplicity is many.
 */
public boolean isMultiplicityMany() {
return multiplicity == MANY;
}

/**
 * Should this entity be deleted when related entity is deleted.
 */
public boolean isCascadeDelete() {
return cascadeDelete;
}

/**
 * Gets the name of the entity that has this role.
 */
public String getEntityName() {
return entityName;
}

/**
 * Gets the name of the entity's cmr field for this role.
 */
public String getCMRFieldName() {
return cmrFieldName;
}

/**
 * Gets the type of the cmr field (i.e., collection or set)
 */
public String getCMRFieldType() {
return cmrFieldType;
}

 public void importEjbJarXml (Element element) throws DeploymentException {
   // ejb-relationship-role-name?
relationshipRoleName = getElementContent(getOptionalChild(element, 
ejb-relationship-role-name));

// multiplicity
String multiplicityString = getElementContent(getUniqueChild(element, 
multiplicity));
if(One.equals(multiplicityString)) {
multiplicity = ONE;
} else if(Many.equals(multiplicityString)) {
multiplicity = MANY;
} else {
throw new DeploymentException(multiplicity should be One or 
Many but is  + multiplicityString);
}

// cascade-delete? 
Element cascadeDeleteElement = getOptionalChild(element, 
cascade-delete);
if(cascadeDeleteElement != null) {
cascadeDelete = true;
}

// relationship-role-source
Element relationshipRoleSourceElement = getUniqueChild(element, 
relationship-role-source);
entityName = 
getElementContent(getUniqueChild(relationshipRoleSourceElement, ejb-name));

// cmr-field?
Element cmrFieldElement = getOptionalChild(element, cmr-field);
if(cmrFieldElement != null) {
// cmr-field-name
cmrFieldName = 
getElementContent(getUniqueChild(cmrFieldElement, cmr-field-name));

   // cmr-field-type?
Element cmrFieldTypeElement = 
getOptionalChild(cmrFieldElement, cmr-field-type);
if(cmrFieldTypeElement != null

[JBoss-dev] CVS update: jboss/src/main/org/jboss/metadata RelationMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 13:50:25

  Added:   src/main/org/jboss/metadata RelationMetaData.java
  Log:
  Represents one ejb-relation element found in the ejb-jar.xml
  file's relationships elements.
  
  Revision  ChangesPath
  1.1  jboss/src/main/org/jboss/metadata/RelationMetaData.java
  
  Index: RelationMetaData.java
  ===
  /*
   * JBoss, the OpenSource EJB server
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.metadata;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  
  import org.w3c.dom.Element;
  import org.jboss.ejb.DeploymentException;
  
  /** 
   * Represents one ejb-relation element found in the ejb-jar.xml
   * file's relationships elements.
   *
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   * @version $Revision: 1.1 $
   */
  public class RelationMetaData extends MetaData {
/** Name of the relation. Loaded from the ejb-relation-name element. */
private String relationName;

/** 
 * The left relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
private RelationshipRoleMetaData left;
  
/** 
 * The right relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
private RelationshipRoleMetaData right; 

/** 
 * Gets the relation name. 
 * Relation name is loaded from the ejb-relation-name element.
 */
public String getRelationName() {
return relationName;
}

/** 
 * Gets the left relationship role. 
 * The relationship role is loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
public RelationshipRoleMetaData getLeftRelationshipRole() {
return left;
}

/** 
 * Gets the right relationship role.
 * The relationship role is loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
public RelationshipRoleMetaData getRightRelationshipRole() {
return right;
}

 public void importEjbJarXml (Element element) throws DeploymentException {
   // name
relationName = getElementContent(getOptionalChild(element, 
ejb-relation-name));

// left role
Iterator iter = getChildrenByTagName(element, ejb-relationship-role);
if(iter.hasNext()) {
left = new RelationshipRoleMetaData();
left.importEjbJarXml((Element) iter.next());
} else {
throw new DeploymentException(Expected 2 
ejb-relationship-role roles but found none);
}

// right role
if(iter.hasNext()) {
right = new RelationshipRoleMetaData();
right.importEjbJarXml((Element) iter.next());
} else {
throw new DeploymentException(Expected 2 
ejb-relationship-role but only found one);
}
  
// assure there are only two ejb-relationship-role elements
if(iter.hasNext()) {
throw new DeploymentException(Expected only 2 
ejb-relationship-role but found more then 2);
}

// verify cascade delete
if(left.isCascadeDelete()  right.isMultiplicityMany()) {
throw new DeploymentException(cascade-delete is only allowed 
in ejb-relationship-role where the other role has a multiplicity One);
}
if(right.isCascadeDelete()  left.isMultiplicityMany()) {
throw new DeploymentException(cascade-delete is only allowed 
in ejb-relationship-role where the other role has a multiplicity One);
}
}
  }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/metadata BeanMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 13:52:19

  Modified:src/main/org/jboss/metadata BeanMetaData.java
  Log:
  Added local jndi name, which is the jndi name to which the local home is bound.
  
  Revision  ChangesPath
  1.26  +19 -1 jboss/src/main/org/jboss/metadata/BeanMetaData.java
  
  Index: BeanMetaData.java
  ===
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/metadata/BeanMetaData.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- BeanMetaData.java 2001/06/20 07:14:16 1.25
  +++ BeanMetaData.java 2001/07/09 20:52:19 1.26
  @@ -29,7 +29,7 @@
*   @author a href=mailto:[EMAIL PROTECTED];Daniel OConnor/a
*   @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
*   @author a href=mailto:[EMAIL PROTECTED];Ole Husgaard/a 
  - *   @version $Revision: 1.25 $
  + *   @version $Revision: 1.26 $
*/
   public abstract class BeanMetaData extends MetaData {
   // Constants -
  @@ -91,8 +91,12 @@
   private ArrayList excludedMethods = new ArrayList();
   
   // from jboss.xml
  +  
   /** The JNDI name under with the home interface should be bound */
   private String jndiName;
  +
  +/** The JNDI name under with the local home interface should be bound */
  +private String localJndiName;
   protected String configurationName;
   private ConfigurationMetaData configuration;
   private String securityProxy;
  @@ -159,6 +163,17 @@
   return jndiName;
   }

  +   /** 
  +  * Gets the JNDI name under with the local home interface should be bound.
  +  * The default is local/ejbName
  +  */
  + public String getLocalJndiName() { 
  + if (localJndiName == null) {
  + localJndiName = local/ + ejbName;
  + }
  + return localJndiName;
  + }
  + 
   public String getConfigurationName()
   {
   if (configurationName == null) {
  @@ -393,6 +408,9 @@
   // set the jndi name, (optional) 
   jndiName = getElementContent(getOptionalChild(element, jndi-name));

  +// set the JNDI name under with the local home interface should be bound 
(optional)  
  +localJndiName = getElementContent(getOptionalChild(element, 
local-jndi-name));
  +
   // set the configuration (optional)
   configurationName = getElementContent(getOptionalChild(element, 
configuration-name));
   if (configurationName != null  
getApplicationMetaData().getConfigurationMetaDataByName(configurationName) == null) {
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/local BaseLocalContainerInvoker.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 14:09:21

  Modified:src/main/org/jboss/ejb/plugins/local
BaseLocalContainerInvoker.java
  Log:
  Added code which binds local home interface into jndi.
  
  Revision  ChangesPath
  1.8   +67 -3 
jboss/src/main/org/jboss/ejb/plugins/local/BaseLocalContainerInvoker.java
  
  Index: BaseLocalContainerInvoker.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/local/BaseLocalContainerInvoker.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BaseLocalContainerInvoker.java2001/06/18 20:01:25 1.7
  +++ BaseLocalContainerInvoker.java2001/07/09 21:09:21 1.8
  @@ -22,6 +22,7 @@
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Proxy;
   
  +import org.jboss.ejb.LocalHomeObjectFactory;
   import javax.ejb.EJBMetaData;
   import javax.ejb.EJBLocalHome;
   import javax.ejb.EJBLocalObject;
  @@ -33,11 +34,15 @@
   import javax.transaction.TransactionRequiredException;
   import javax.ejb.TransactionRolledbackLocalException;
   import javax.transaction.TransactionRolledbackException;
  +
   import javax.naming.Name;
   import javax.naming.InitialContext;
   import javax.naming.Context;
   import javax.naming.NamingException;
   import javax.naming.NameNotFoundException;
  +import javax.naming.Reference;
  +import javax.naming.StringRefAddr;
  +
   import javax.transaction.Transaction;
   import javax.transaction.TransactionManager;
   
  @@ -129,14 +134,52 @@
  }
   
  public void start()
  -   throws Exception
  +  throws Exception
  {
  -  // put in the static hashmap
  + Class localHome = 
((ContainerInvokerContainer)container).getLocalHomeClass();
  +if(localHome == null) {
  + Logger.debug(container.getBeanMetaData().getEjbName() +  
cannot be Bound, doesn't have local home.);
  + return;
  + }
  + 
  + InitialContext context = new InitialContext();
  + String jndiName = container.getBeanMetaData().getLocalJndiName();
  + String beanName = container.getBeanMetaData().getEjbName();
  + 
  + // unique key name
  + String uniqueKey = Long.toString( (new java.util.Date()).getTime() );
  +
  + // setup local home object factory, which is used for non-serializable 
objects such as local home
  + 
  + // create link from unique name to application and container
  + LocalHomeObjectFactory.rebind( uniqueKey + jndiName, 
container.getApplication(), container);
  + 
  + // address used to lookup referance in LocalHomeObjectFactory
  + StringRefAddr refAddr = new StringRefAddr(nns, uniqueKey + jndiName 
);
  + 
  + // create a jndi referance to LocalHomeObjectFactory 
  + Reference jndiRef = new 
Reference(container.getBeanMetaData().getLocalHome(),
  + refAddr, LocalHomeObjectFactory.class.getName(), null );
  + 
  + // bind that referance to my name
  + rebind(context, jndiName, jndiRef);
  +
  + Logger.debug(Bound Local  + beanName +  to  + jndiName);
  }
   
  public void stop()
  {
  -  // remove from the static hashmap
  + Class localHome = 
((ContainerInvokerContainer)container).getLocalHomeClass();
  +if(localHome == null) {
  + return;
  + }
  + 
  +  try {
  + InitialContext ctx = new InitialContext();
  + ctx.unbind(container.getBeanMetaData().getLocalJndiName());
  +  } catch (Exception e) {
  + // ignore.
  +  }
  }
   
  public void destroy()
  @@ -290,6 +333,27 @@
 }
  }
  
  + /**
  +  * Rebinds the object into the jndi context are the specified name.
  +  */
  +   protected void rebind(Context ctx, String name, Object val)
  +  throws NamingException
  +   {
  +  // Bind val to name in ctx, and make sure that all intermediate contexts exist
  +
  +  Name n = ctx.getNameParser().parse(name);
  +  while (n.size()  1) {
  + String ctxName = n.get(0);
  + try {
  +ctx = (Context)ctx.lookup(ctxName);
  + } catch (NameNotFoundException e) {
  +ctx = ctx.createSubcontext(ctxName);
  + }
  + n = n.getSuffix(1);
  +  }
  +
  +  ctx.rebind(n.get(0), val);
  +   }
   
  class HomeProxy extends LocalHomeProxy
 implements InvocationHandler
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationshipRoleMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 14:45:59

  Added:   src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCRelationshipRoleMetaData.java
  Log:
  Represents one ejb-relationship-role element found in the ejb-jar.xml
  file's ejb-relation elements.
  
  Revision  ChangesPath
  1.1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationshipRoleMetaData.java
  
  Index: JDBCRelationshipRoleMetaData.java
  ===
  /*
   * JBoss, the OpenSource EJB server
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.ejb.plugins.cmp.jdbc.metadata;
  
  import org.jboss.ejb.DeploymentException;
  import org.jboss.metadata.MetaData;
  import org.jboss.metadata.RelationshipRoleMetaData;
  import org.w3c.dom.Element;
  
  /** 
   * Represents one ejb-relationship-role element found in the ejb-jar.xml
   * file's ejb-relation elements.
   *
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   * @version $Revision: 1.1 $
   */
  public class JDBCRelationshipRoleMetaData extends MetaData {
/**
 * Relation to which this role belongs.
 */
private JDBCRelationMetaData relationMetaData;
  
/**
 * Role name
 */
private String relationshipRoleName;

/**
 * is the multiplicity one?
 */
private boolean multiplicityOne;

/**
 * Should this entity be deleted when related entity is deleted.
 */
private boolean cascadeDelete;

/**
 * The entity that has this role.
 */
private JDBCEntityMetaData entity;

/**
 * Name of the entity's cmr field for this role.
 */
private String cmrFieldName;
  

/**
 * Type of the cmr field (i.e., collection or set)
 */
private String cmrFieldType;

/**
 * The related role's jdbc meta data.
 */
private JDBCRelationshipRoleMetaData relatedRole;
  
public JDBCRelationshipRoleMetaData(
RelationshipRoleMetaData relationshipRole,
JDBCRelationMetaData relationMetaData,
JDBCApplicationMetaData applicationMetaData) {

this.relationMetaData = relationMetaData;

relationshipRoleName = relationshipRole.getRelationshipRoleName();
multiplicityOne = relationshipRole.isMultiplicityOne();
cascadeDelete = relationshipRole.isCascadeDelete();

cmrFieldName = relationshipRole.getCMRFieldName();
cmrFieldType = relationshipRole.getCMRFieldType();
  
String entityName = relationshipRole.getEntityName();

entity = applicationMetaData.getBeanByEjbName(entityName);

// inform the entity about this role
entity.addRelationshipRole(this);
}
  
/**
 * Gets the relation to which this role belongs.
 */
public JDBCRelationMetaData getRelationMetaData() {
return relationMetaData;
}

/**
 * Gets the name of this role.
 */
public String getRelationshipRoleName() {
return relationshipRoleName;
}

/**
 * Checks if the multiplicity is one.
 */
public boolean isMultiplicityOne() {
return multiplicityOne;
}

/**
 * Checks if the multiplicity is many.
 */
public boolean isMultiplicityMany() {
return !multiplicityOne;
}

/**
 * Should this entity be deleted when related entity is deleted.
 */
public boolean isCascadeDelete() {
return cascadeDelete;
}

/**
 * Gets the name of the entity that has this role.
 */
public JDBCEntityMetaData getEntity() {
return entity;
}

/**
 * Gets the name of the entity's cmr field for this role.
 */
public String getCMRFieldName() {
return cmrFieldName;
}

/**
 * Gets the type of the cmr field (i.e., collection or set)
 */
public String getCMRFieldType() {
return cmrFieldType;
}   
  
/**
 * Sets the related role's jdbc meta data.
 */
public void setRelatedRole(JDBCRelationshipRoleMetaData relatedRole) {
this.relatedRole = relatedRole;
}

/**
 * Gets the related role's jdbc meta data

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCApplicationMetaData.java JDBCEntityMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 14:49:23

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCApplicationMetaData.java
JDBCEntityMetaData.java
  Log:
  Added relationship metadata.
  
  Revision  ChangesPath
  1.5   +53 -14
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCApplicationMetaData.java
  
  Index: JDBCApplicationMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCApplicationMetaData.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCApplicationMetaData.java  2001/06/27 03:55:36 1.4
  +++ JDBCApplicationMetaData.java  2001/07/09 21:49:23 1.5
  @@ -6,30 +6,27 @@
*/
   package org.jboss.ejb.plugins.cmp.jdbc.metadata;
   
  +import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  -
  -import javax.sql.DataSource;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  -
  -import org.w3c.dom.Element;
  -
  -import org.jboss.logging.Logger;
  +import javax.sql.DataSource;
   import org.jboss.ejb.DeploymentException;
  -
  -import org.jboss.metadata.XmlLoadable;
  -import org.jboss.metadata.MetaData;
  +import org.jboss.logging.Logger;
  +import org.jboss.metadata.ApplicationMetaData;
   import org.jboss.metadata.BeanMetaData;
   import org.jboss.metadata.EntityMetaData;
  -import org.jboss.metadata.ApplicationMetaData;
  -
  +import org.jboss.metadata.MetaData;
  +import org.jboss.metadata.RelationMetaData;
  +import org.jboss.metadata.XmlLoadable;
  +import org.w3c.dom.Element;
   
   /** 
*  
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
*   @author a href=[EMAIL PROTECTED]Sebastien Alborini/a
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
*/
   public class JDBCApplicationMetaData extends MetaData implements XmlLoadable {
// Constants -
  @@ -59,10 +56,16 @@

// the type mapping to use with the specified database
private JDBCTypeMappingMetaData typeMapping;
  - 
  +
  + /**
  +  * Map of relations in this application by name.
  +  * Items are instance of JDBCRelationMetaData.
  +  */
  + private HashMap relationships = new HashMap();
  +
// all the available dependent value classes (by javaType)
private HashMap valueClasses = new HashMap();
  - 
  + 

// Static 

  @@ -94,6 +97,14 @@
}
}
}
  + 
  + // relationships
  + Iterator iterator = applicationMetaData.getRelationships();
  + while(iterator.hasNext()) {
  + RelationMetaData relation = (RelationMetaData) iterator.next();
  + JDBCRelationMetaData jdbcRelation = new 
JDBCRelationMetaData(relation, this);
  + relationships.put(jdbcRelation.getRelationName(), 
jdbcRelation);
  + }   
}


  @@ -110,6 +121,14 @@
return typeMapping;
}

  + /**
  +  * Get the container managed relations in this application.
  +  * Items are instance of JDBCRelationMetaData.
  +  */
  + public Iterator getRelationships() {
  + return relationships.values().iterator();
  + }
  + 
public Iterator getValueClasses() {
return valueClasses.values().iterator();
}
  @@ -217,6 +236,26 @@
}
}

  + // relationships
  + // get the beans data (only in jbosscmp-jdbc.xml)
  + Element relationshipsElement = getOptionalChild(element, 
relationships);
  + if(relationshipsElement != null) {
  + iterator = getChildrenByTagName(relationshipsElement, 
ejb-relation);  
  + while(iterator.hasNext()) {
  + Element relationElement = (Element)iterator.next();
  +
  + // get the bean's data, gaurenteed to work because we 
create
  + // a metadata object for each bean in the constructor.
  + String relationName = 
getElementContent(getUniqueChild(relationElement, ejb-relation-name));
  + JDBCRelationMetaData relation = 
(JDBCRelationMetaData)relationships.get(relationName); 
 
  + if(relation != null) {
  + relation.importXml(relationElement);
  + } else

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationMetaData.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 14:47:26

  Added:   src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCRelationMetaData.java
  Log:
  Represents one ejb-relation element found in the ejb-jar.xml
  file's relationships elements.
  
  Revision  ChangesPath
  1.1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationMetaData.java
  
  Index: JDBCRelationMetaData.java
  ===
  /*
   * JBoss, the OpenSource EJB server
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.ejb.plugins.cmp.jdbc.metadata;
  
  import java.util.Iterator;
  import org.jboss.ejb.DeploymentException;
  import org.jboss.metadata.MetaData;
  import org.jboss.metadata.RelationMetaData;
  import org.jboss.metadata.RelationshipRoleMetaData;
  import org.w3c.dom.Element;
  
  /**
   * Represents one ejb-relation element found in the ejb-jar.xml
   * file's relationships elements.
   *
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   *@version $Revision: 1.1 $
   */
  public class JDBCRelationMetaData extends MetaData {
private final static int TABLE = 1;
private final static int FOREIGN_KEY = 2;

/** Name of the relation. Loaded from the ejb-relation-name element. */
private String relationName;
  
/** 
 * The left jdbc relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
private JDBCRelationshipRoleMetaData left;
  
/** 
 * The right relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
private JDBCRelationshipRoleMetaData right;

/**
 * The mapping style for this relation (i.e., TABLE or FOREIGN_KEY).
 */
private int mappingStyle;

// the name of the table to use for this bean
private String tableName;

// do we have to try and create the table on deployment?
private boolean createTable;

// do we have to drop the table on undeployment?
private boolean removeTable;

// do we use 'SELECT ... FOR UPDATE' syntax?
private boolean selectForUpdate;

// is the bean read-only?
private boolean readOnly;

// how long is read valid
private int readTimeOut = -1;

// should the table have a primary key constraint?
private boolean primaryKeyConstraint;

public JDBCRelationMetaData(
RelationMetaData relationMetaData,
JDBCApplicationMetaData applicationMetaData) {
relationName = relationMetaData.getRelationName();

RelationshipRoleMetaData leftRole = 
relationMetaData.getLeftRelationshipRole();
RelationshipRoleMetaData rightRole = 
relationMetaData.getRightRelationshipRole();
  
left = new JDBCRelationshipRoleMetaData(leftRole, this, 
applicationMetaData);
right = new JDBCRelationshipRoleMetaData(rightRole, this, 
applicationMetaData);

// give each role a referance to the other
left.setRelatedRole(right);
right.setRelatedRole(left);

if(left.isMultiplicityMany()  right.isMultiplicityMany()) {
mappingStyle = TABLE;
tableName = left.getEntity().getName() + _ + 
left.getCMRFieldName() +
right.getEntity().getName() + _ + 
right.getCMRFieldName();
} else {
mappingStyle = FOREIGN_KEY; 
}   
}
  
public void importXml(Element element) throws DeploymentException {
 
// mapping style
String mappingStyleString = 
getElementContent(getOptionalChild(element, mapping-style));
if(mappingStyleString != null) {
if(mappingStyleString.equals(table)) {
mappingStyle = TABLE;
} else if(mappingStyleString.equals(foreign-key)) {
mappingStyle = FOREIGN_KEY;
if(left.isMultiplicityMany()  
right.isMultiplicityMany()) {
throw new DeploymentException(Foreign key 
mapping-style is not allowed for many-to-many relationsips.);
}
} else {
throw new DeploymentException(Unknown mapping-style: 
 + mappingStyleString

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp CMPStoreManager.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 16:59:58

  Modified:src/main/org/jboss/ejb/plugins/cmp CMPStoreManager.java
  Log:
  Added container managed relationships.
  
  Revision  ChangesPath
  1.2   +1 -3  jboss/src/main/org/jboss/ejb/plugins/cmp/CMPStoreManager.java
  
  Index: CMPStoreManager.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/CMPStoreManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CMPStoreManager.java  2001/06/24 03:23:13 1.1
  +++ CMPStoreManager.java  2001/07/09 23:59:58 1.2
  @@ -61,7 +61,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
* @see org.jboss.ejb.EntityPersistenceStore
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public abstract class CMPStoreManager 
  implements EntityPersistenceStore2
  @@ -227,8 +227,6 @@
   
  public static class PersistenceContext {
public Map fieldState = new HashMap();
  -  public Object[] state;
  -  public long lastRead = -1;
  }
   }
   
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/bridge CMPFieldBridge.java CMRFieldBridge.java EntityBridgeInvocationHandler.java

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 16:59:58

  Modified:src/main/org/jboss/ejb/plugins/cmp/bridge
CMPFieldBridge.java CMRFieldBridge.java
EntityBridgeInvocationHandler.java
  Log:
  Added container managed relationships.
  
  Revision  ChangesPath
  1.2   +4 -1  
jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java
  
  Index: CMPFieldBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/CMPFieldBridge.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CMPFieldBridge.java   2001/06/24 03:23:14 1.1
  +++ CMPFieldBridge.java   2001/07/09 23:59:58 1.2
  @@ -19,7 +19,7 @@
*   One for each entity bean cmp field. 
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public interface CMPFieldBridge {
public String getFieldName();
  @@ -33,6 +33,9 @@
public Object getPrimaryKeyValue(Object primaryKey) throws 
IllegalArgumentException;
  public Object setPrimaryKeyValue(Object primaryKey, Object value) throws 
IllegalArgumentException;
   
  + /**
  + * Set CMPFieldValue to Java default value (i.e., 0 or null).
  + */
public void initInstance(EntityEnterpriseContext ctx);
   
/**
  
  
  
  1.2   +2 -2  
jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/CMRFieldBridge.java
  
  Index: CMRFieldBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/CMRFieldBridge.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CMRFieldBridge.java   2001/06/24 03:23:14 1.1
  +++ CMRFieldBridge.java   2001/07/09 23:59:58 1.2
  @@ -20,11 +20,11 @@
* one per relationship (shared between two beans).  
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public interface CMRFieldBridge {
public String getFieldName();
  - public Class getFieldType();
  +//   public Class getFieldType();

public Object getValue(EntityEnterpriseContext ctx);
  public void setValue(EntityEnterpriseContext ctx, Object value);
  
  
  
  1.2   +65 -15
jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/EntityBridgeInvocationHandler.java
  
  Index: EntityBridgeInvocationHandler.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/EntityBridgeInvocationHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EntityBridgeInvocationHandler.java2001/06/24 03:23:14 1.1
  +++ EntityBridgeInvocationHandler.java2001/07/09 23:59:58 1.2
  @@ -32,18 +32,26 @@
*   One per cmp entity bean instance, including beans in pool. 
 
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class EntityBridgeInvocationHandler implements InvocationHandler {
protected EntityBridge entityBridge;
protected Class beanClass;
protected EntityEnterpriseContext ctx;
protected Map cmpFieldMap;
  + protected Map cmrFieldMap;

public EntityBridgeInvocationHandler(EntityBridge entityBridge, Class 
beanClass) throws Exception {
this.entityBridge = entityBridge;
this.beanClass = beanClass;
  - setupCMPFieldMap(getAbstractAccessors());
  + Map abstractAccessors = getAbstractAccessors();
  + setupCMPFieldMap(abstractAccessors);
  + try {
  + setupCMRFieldMap(abstractAccessors);
  + } catch(Exception e) {
  + e.printStackTrace();
  + throw e;
  + }
}

public void setContext(EntityEnterpriseContext ctx) {
  @@ -68,9 +76,25 @@
cmpField.setInstanceValue(ctx, args[0]);
return null;
}
  - throw new IllegalArgumentException(Unknown cmp field method: 
 + methodName);
  + Exception e = new EJBException(Unknown cmp field method:  + 
methodName);
  + e.printStackTrace();
  + throw e;
}
  - throw new IllegalArgumentException(Unknown method type:  + 
methodName);
  +
  + CMRFieldBridge cmrField = (CMRFieldBridge) cmrFieldMap.get

[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjboss.xml

2001-07-09 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/09 17:04:56

  Modified:src/etc/conf/default standardjboss.xml
  Log:
  Added JDBC relation interceptor for EJB 2.0 CMP.
  
  Revision  ChangesPath
  1.11  +2 -1  jboss/src/etc/conf/default/standardjboss.xml
  
  Index: standardjboss.xml
  ===
  RCS file: /cvsroot/jboss/jboss/src/etc/conf/default/standardjboss.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- standardjboss.xml 2001/06/24 01:21:14 1.10
  +++ standardjboss.xml 2001/07/10 00:04:56 1.11
  @@ -15,6 +15,7 @@
   interceptor 
metricsEnabled=trueorg.jboss.ejb.plugins.MetricsInterceptor/interceptor
   
interceptororg.jboss.ejb.plugins.EntityInstanceInterceptor/interceptor
   
interceptororg.jboss.ejb.plugins.EntitySynchronizationInterceptor/interceptor
  +
interceptororg.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor/interceptor
   /container-interceptors

instance-poolorg.jboss.ejb.plugins.EntityInstancePool/instance-pool

instance-cacheorg.jboss.ejb.plugins.EntityInstanceCache/instance-cache
  @@ -41,7 +42,7 @@
MaximumSize100/MaximumSize
MinimumSize10/MinimumSize
/container-pool-conf
  - commit-optionA/commit-option
  + commit-optionB/commit-option
 /container-configuration
   
container-configuration
  
  
  

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



[JBoss-dev] EJB 2.0 Container Managed Relations in Tip

2001-07-09 Thread Dain Sundstrom

I have (finally) committed the code for EJB 2.0 CMR fields.  It took longer
than I thought mainly because Marc's update of the entity interceptor code
showed me a major flaw in my implementation when there is more then one
concurrent transaction. Anyway, it's in and you can start to play with it
now. I will follow up with quick docs later.  Here are some notes for now:

1.  All relation types in spec should work. I built a test suite based on
the test in the specification.

2. Relationships don't eager load (read-ahead).  I think I will add this in
the EJB-QL phase, as EJB-QL will have the same problem.

3. There are two mapping styles: table and foreign key. You specify which
style in the jbosscmp-jdbc.xml file as follows:

relationships
ejb-relation
ejb-relation-nameAB_OneToMany_Bi_Table/ejb-relation-name
mapping-styletable/mapping-style
table-nameAB_OneToManyBi/table-name
/ejb-relation

ejb-relation
ejb-relation-nameAB_OneToMany_Bi_FK/ejb-relation-name
mapping-styleforeign-key/mapping-style
/ejb-relation
/relationships

4. You can't currently override the names and other info of relation
columns. I will add the configuration code soon.

5. I added code to bind the local home into jndi (I needed it for testing).
Remember relationships are only allowed between local interfaces. Just add
local-jndi-name element to the entity element in the jboss.xml. An example
follows:

entity
ejb-nameB_ManyToOne_Uni_Table_EJB/ejb-name

local-jndi-namerelation/manyToOne/unidirectional/table/B/local-jndi-name
/entity


6. I implemented the relationships with an invocation interceptor (it was
necessary). See JDBCRelationInterceptor in the
org.jboss.ejb.plugins.cmp.jdbc.  In the future, the interceptor could be
made more generic for other persistence managers, but for now the code is
too new to do.

Check it out,

Dain Sundstrom


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



[JBoss-dev] RE: [JBoss-user] log4j or JBoss logging

2001-07-11 Thread Dain Sundstrom

I posted the original message to the wrong forum (user forum), and almost
lost the responses in all the traffic.

I will switch over to direct log4j soon.  

Has anyone given any thought to how we should organize the log categories?  

For example, what root are we going to use 'jboss' or 'org.jboss'?  

I think we should follow class package name as close a possible, so cmp
messages would start at 'org.jboss.ejb.plugins.cmp'.

My current plan is to use 
'org.jboss.ejb.plugins.cmp.BeanName.JDBCCommandName'

-dain

 -Original Message-
 From: Scott M Stark [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 10, 2001 2:48 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [JBoss-user] log4j or JBoss logging
 
 
 Change to use log4j. The JBoss interface will disappear in 3.0
 
 - Original Message -
 From: Dain Sundstrom [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, July 10, 2001 12:08 PM
 Subject: [JBoss-user] log4j or JBoss logging
 
 
  As I modify the JBossCMP code should I change the logging 
 over to use
 log4j
  directly or should I leave the code logging via the JBoss log layer?
 
  If I should switch to direct log4j, how do we categorize 
 the logs? I was
  thinking jboss.ejb.plugins.cmp.BeanName.JDBCCommandName 
 or some thing
  like that.  This way I could turn off messages from beans 
 and commands I'm
  not testing.
 
  -dain
 
  ___
  JBoss-user mailing list
  [EMAIL PROTECTED]
  http://lists.sourceforge.net/lists/listinfo/jboss-user
 
 
 
 ___
 JBoss-user mailing list
 [EMAIL PROTECTED]
 http://lists.sourceforge.net/lists/listinfo/jboss-user
 

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



RE: [JBoss-dev] RE: [JBoss-user] log4j or JBoss logging

2001-07-11 Thread Dain Sundstrom

 I think we want to use the fully qualified classname. 

Ok.

 If the bean name is
 added it should be appended to the classname. We need to be careful not
 to introduce a lot of overhead in obtaining the logging category by
 constructing highly dynamic category names.
 

Are you sure that there is a lot of overhead when obtaining a logging
category? If there is, I will make sure to obtain all categories during
container initialization and not on the fly.  I assume that it is ok to
perform expensive operations during initialization.

-dain

 - Original Message -
 From: Dain Sundstrom [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, July 11, 2001 7:46 AM
 Subject: [JBoss-dev] RE: [JBoss-user] log4j or JBoss logging
 
 
  I posted the original message to the wrong forum (user 
 forum), and almost
  lost the responses in all the traffic.
 
  I will switch over to direct log4j soon.
 
  Has anyone given any thought to how we should organize the 
 log categories?
 
  For example, what root are we going to use 'jboss' or 'org.jboss'?
 
  I think we should follow class package name as close a 
 possible, so cmp
  messages would start at 'org.jboss.ejb.plugins.cmp'.
 
  My current plan is to use
  'org.jboss.ejb.plugins.cmp.BeanName.JDBCCommandName'
 
  -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



Re: [JBoss-dev] jboss + jndi + ldap for ejb referencing

2001-07-13 Thread Dain Sundstrom

Nick,

I don't know if this helps, but the server always attempts to bind the home
interface into the directory.  The code is in
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker method start.  For a
local home, the code is located in
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker. Hopefully this helps
to get your feet pointed in the right direction.

-dain

- Original Message -
From: Nick Betteridge [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 13, 2001 10:04 AM
Subject: Re: [JBoss-dev] jboss + jndi + ldap for ejb referencing


 I think I may have made some progress:

 I reduced my test application to be as simple as possible and now the
 application deploys. However, if I look at the directory server log
 file, I can see my client searching for the EJB home interface, but
 there is no record of the deployer adding the home reference to the
 directory server.

 I'm currently going though the deployment and naming dirs to see if I
 can pick out the problem. If anyone can add any input, I'd be very
 grateful.

 -


 [J2EE Deployer Default] Deploy J2EE application:
 file:/export/home/nick/servers/jboss/JBoss-2.4.0BETA/deploy/admin-ejb.jar
 [J2EE Deployer Default] Create application admin-ejb.jar
 [J2EE Deployer Default] install module admin-ejb.jar
 [Container factory]

Deploying:file:/export/home/nick/servers/jboss/JBoss-2.4.0BETA/tmp/deploy/De
fault/admin-ejb.jar
 [Verifier] Verifying

file:/export/home/nick/servers/jboss/JBoss-2.4.0BETA/tmp/deploy/Default/admi
n-ejb.jar/ejb1002.jar
 [Container factory] Deploying ClientEJB
 [ContainerManagement] Initializing
 [ContainerManagement] Initialized
 [ContainerManagement] Starting
 [ContainerManagement] Started
 [Default] Added ClassLoader: org.jboss.web.WebClassLoader@5db13f URL:
 http://wotan:8083/WebClassLoader@6140223/
 [Container factory] Deployed application:

file:/export/home/nick/servers/jboss/JBoss-2.4.0BETA/tmp/deploy/Default/admi
n-ejb.jar
 [J2EE Deployer Default] J2EE application:
 file:/export/home/nick/servers/jboss/JBoss-2.4.0BETA/deploy/admin-ejb.jar
 is deployed.


 ejb-jar
enterprise-beans
  session
ejb-nameClientEJB/ejb-namedmin
homecom.syntactics.server.admin.share.ClientHome/home
remotecom.syntactics.server.admin.share.Client/remote
ejb-classcom.syntactics.server.admin.ejb.ClientEJB/ejb-class
session-typeStateful/session-type
transaction-typeBean/transaction-type
  /session
/enterprise-beans
  /ejb-jar


 jboss
enterprise-beans
  session
ejb-nameClientEJB/ejb-name
jndi-nameclients/jndi-name
  /session
/enterprise-beans
  /jboss


 !-- Bind a remote LDAP server --
  mbean code=org.jboss.naming.ExternalContext
 name=DefaultDomain:service=ExternalContext,jndiName=clients 
  attribute name=JndiNameclients/attribute
  attribute name=Propertiessyntactics.ldap/attribute
  attribute
 name=InitialContextjavax.naming.ldap.InitialLdapContext/attribute
  attribute name=RemoteAccesstrue/attribute
  /mbean

 syntactics.ldap:
 java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
 java.naming.provider.url=ldap://ds.syntactics.com:389/o=application

 ___
 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] new wait(1000) not good

2001-07-19 Thread Dain Sundstrom

Bill and Georg,

I wrote a lock manager several years ago, so my comments may be out dated.
I remember that, if I wanted to wake the waiting threads in a specific order
(LIFO FIFO), we would have each thread wait on a different object so it
could be awoken individually. Before the thread waits on the object it puts
the object in a collection. When the thread with the lock releases the lock,
it selects the next thread from the collection, removes the object, and
calls notify.  It is a pretty simple trick in the code.

By the way, has anyone considered using an external lock manager instead of
coding one directly into the interceptor. When I wrote my lock manager there
were no freely available managers, but I think there are several now.

Dain

 -Original Message-
 From: Bill Burke [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 18, 2001 11:31 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [JBoss-dev] new wait(1000) not good
 
 
 Thanks Georg for clearing that up.
 
 Bill
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On 
 Behalf Of Georg
  Rehfeld
  Sent: Thursday, July 19, 2001 12:06 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [JBoss-dev] new wait(1000) not good
 
 
  Hi Bill,
 
   I'm also worried about this same scenario with the new 
 locking stuff in
  the
   mainline.  With notifyAll instead of just notify is there 
 a chance to
  starve
   threads?  With notify aren't you guarateed FIFO for lock 
 contention, but
  you
   wouldn't be guaranteed with a notifyAll?
 
  notify does NOT guarantee FIFO awakening of threads: the docs
  explicitely state:
 
  | The choice is arbitrary and occurs at the discretion of the
  | implementation.
 
  i.e. a LIFO or whatever implementation might lead to starvation.
 
  notifyAll seems to be MUCH better as of the docs:
 
  | The awakened threads will compete in the usual manner with
  | any other threads that might be actively competing to
  | synchronize on this object; for example, the awakened threads
  | enjoy no reliable privilege or disadvantage in being the next
  | thread to lock this object.
 
  So every thread, if it was waiting before or just coming in
  fresh, has the same chance to get the lock and proceed, avoiding
  starvation.
 
  Bye
  Georg
   ___   ___
  | + | |__Georg Rehfeld  Woltmanstr. 12 20097 Hamburg
  |_|_\ |___   [EMAIL PROTECTED]   +49 (40) 23 53 27 10
 
 
 
  ___
  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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCRelationKeyField.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 19:36:32

  Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge
JDBCRelationKeyField.java
  Log:
  No longer used. Functionality was merged back into JDBCCMP2xFieldBridge.

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCForeignKeyField.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 19:36:57

  Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge
JDBCForeignKeyField.java
  Log:
  No longer used. Functionality was merged back into JDBCCMP2xFieldBridge.

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationMetaData.java JDBCRelationshipRoleMetaData.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 19:39:03

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCRelationMetaData.java
JDBCRelationshipRoleMetaData.java
  Log:
  Changed to be immutable and added configuration of relation mapping.
  
  Revision  ChangesPath
  1.2   +345 -107  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationMetaData.java
  
  Index: JDBCRelationMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JDBCRelationMetaData.java 2001/07/09 21:47:26 1.1
  +++ JDBCRelationMetaData.java 2001/07/26 02:39:03 1.2
  @@ -14,176 +14,349 @@
   import org.w3c.dom.Element;
   
   /**
  - * Represents one ejb-relation element found in the ejb-jar.xml
  + * Imutable class that represents one ejb-relation element found in the ejb-jar.xml
* file's relationships elements.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - *   @version $Revision: 1.1 $
  + *   @version $Revision: 1.2 $
*/
  -public class JDBCRelationMetaData extends MetaData {
  +public final class JDBCRelationMetaData {
private final static int TABLE = 1;
private final static int FOREIGN_KEY = 2;

/** Name of the relation. Loaded from the ejb-relation-name element. */
  - private String relationName;
  + private final String relationName;
   
/** 
 * The left jdbc relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
  - private JDBCRelationshipRoleMetaData left;
  + private final JDBCRelationshipRoleMetaData left;
   
/** 
 * The right relationship role. Loaded from an ejb-relationship-role.
 * Left/right assignment is completely arbitrary.
 */
  - private JDBCRelationshipRoleMetaData right;
  + private final JDBCRelationshipRoleMetaData right;

/**
 * The mapping style for this relation (i.e., TABLE or FOREIGN_KEY).
 */
  - private int mappingStyle;
  + private final int mappingStyle;

  - // the name of the table to use for this bean
  - private String tableName;
  + /** data source name in jndi */
  + private final String dataSourceName;

  - // do we have to try and create the table on deployment?
  - private boolean createTable;
  + /** type mapping used for the relation table */
  + private final JDBCTypeMappingMetaData typeMapping;

  - // do we have to drop the table on undeployment?
  - private boolean removeTable;
  + /** should excess debug information be logged */
  + private final boolean debug;

  - // do we use 'SELECT ... FOR UPDATE' syntax?
  - private boolean selectForUpdate;
  + /** the name of the table to use for this bean */
  + private final String tableName;

  - // is the bean read-only?
  - private boolean readOnly;
  + /** should we create the table when deployed */
  + private final boolean createTable;

  - // how long is read valid
  - private int readTimeOut = -1;
  + /** should we drop the table when deployed */
  + private final boolean removeTable;

  - // should the table have a primary key constraint?
  - private boolean primaryKeyConstraint;
  + /** should we use 'SELECT ... FOR UPDATE' syntax? */
  + private final boolean selectForUpdate;
  + 
  + /** should the table have a primary key constraint? */
  + private final boolean primaryKeyConstraint;
  + 
  + /** is the relationship read-only? */
  + private final boolean readOnly;
  + 
  + /** how long is read valid */
  + private final int readTimeOut;

  - public JDBCRelationMetaData(
  - RelationMetaData relationMetaData,
  - JDBCApplicationMetaData applicationMetaData) {
  + /**
  +  * Constructs jdbc relation meta data with the data from the relation meta 
data loaded
  +  * from the ejb-jar.xml file.
  +  *
  +  * @param jdbcApplication used to retrieve the entities of this relation
  +  * @param relationMetaData relation meta data loaded from the ejb-jar.xml file
  +  */
  + public JDBCRelationMetaData(JDBCApplicationMetaData jdbcApplication, 
RelationMetaData relationMetaData) throws DeploymentException {
relationName = relationMetaData.getRelationName();

RelationshipRoleMetaData leftRole = 
relationMetaData.getLeftRelationshipRole();
RelationshipRoleMetaData rightRole = 
relationMetaData.getRightRelationshipRole

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCAutomaticQueryMetaData.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 19:40:44

  Added:   src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCAutomaticQueryMetaData.java
  Log:
  This class is a place holder for automatically generated queries such as
  findAll().
  
  Revision  ChangesPath
  1.1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCAutomaticQueryMetaData.java
  
  Index: JDBCAutomaticQueryMetaData.java
  ===
  /*
   * JBoss, the OpenSource EJB server
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  package org.jboss.ejb.plugins.cmp.jdbc.metadata;
  
  import java.lang.reflect.Method;
  
  /** 
   *This immutable class contains information about an automatically generated
   * query. This class is a place holder used to make an automaticlly generated
   * query look more like a user specified query.  This class only contains a 
   * referance to the method used to invoke this query.
   *  
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   *@author a href=[EMAIL PROTECTED]Sebastien Alborini/a
   *@version $Revision: 1.1 $
   */
  public final class JDBCAutomaticQueryMetaData implements JDBCQueryMetaData {
/**
 * A referance to the method which invokes this query.
 */
private final Method method;

/**
 * Constructs a JDBCAutomaticQueryMetaData which is invoked by the specified
 * method.
 * @param method the method which invokes this query
 */
public JDBCAutomaticQueryMetaData(Method method) {
this.method = method;
}
  
public Method getMethod() {
return method;
}

/**
 * Compares this JDBCAutomaticQueryMetaData against the specified object. 
Returns
 * true if the objects are the same. Two JDBCAutomaticQueryMetaData are the 
same 
 * if they are both invoked by the same method.
 * @param o the reference object with which to compare
 * @return true if this object is the same as the object argument; false 
otherwise
 */
public boolean equals(Object o) {
if(o instanceof JDBCAutomaticQueryMetaData) {
return ((JDBCAutomaticQueryMetaData)o).method.equals(method);
}
return false;
}

/**
 * Returns a hashcode for this JDBCAutomaticQueryMetaData. The hashcode is 
computed
 * by the method which invokes this query.
 * @return a hash code value for this object
 */
public int hashCode() {
return method.hashCode();
}
/**
 * Returns a string describing this JDBCAutomaticQueryMetaData. The exact 
details
 * of the representation are unspecified and subject to change, but the 
following
 * may be regarded as typical:
 * 
 * [JDBCAutomaticQueryMetaData: method=public org.foo.User 
findByName(java.lang.String)]
 *
 * @return a string representation of the object
 */
public String toString() {
return [JDBCAutomaticQueryMetaData : method= + method + ];
}
  }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationshipRoleMetaData.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 20:02:39

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCRelationshipRoleMetaData.java
  Log:
  Removed lame debugging messages.
  
  Revision  ChangesPath
  1.3   +1 -6  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationshipRoleMetaData.java
  
  Index: JDBCRelationshipRoleMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationshipRoleMetaData.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCRelationshipRoleMetaData.java 2001/07/26 02:39:03 1.2
  +++ JDBCRelationshipRoleMetaData.java 2001/07/26 03:02:39 1.3
  @@ -22,7 +22,7 @@
* ejb-jar.xml file's ejb-relation elements.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public final class JDBCRelationshipRoleMetaData {
/**
  @@ -267,7 +267,6 @@

// no field overrides, we're done
if(foreignKeysElement == null) {
  - System.out.println(NO FOREIGN KEY OVERRIDE);
return;
}

  @@ -276,14 +275,12 @@

// if empty foreign-key-fields element, no fk should be used
if(!fkIter.hasNext()) {
  - System.out.println(NO FOREIGN KEY FOR THIS RELATION);
foreignKeyFields.clear();
}

while(fkIter.hasNext()) {
Element foreignKeyElement = (Element)fkIter.next();
String foreignKeyName = 
MetaData.getUniqueChildContent(foreignKeyElement, field-name);
  - System.out.println(OVERRIDE foreignKeyName=+foreignKeyName);
JDBCCMPFieldMetaData cmpField = 
(JDBCCMPFieldMetaData)foreignKeyFields.get(foreignKeyName);
if(cmpField == null) {
throw new DeploymentException(CMP field for foreign 
key not found: field name=+foreignKeyName);
  @@ -299,10 +296,8 @@
 */
private void loadTableKeyFields(Element element) throws DeploymentException {
// load all pks of entity into tableKeys map
  - System.out.println(Entity cmp field count + 
entity.getCMPFields().size());
for(Iterator i = entity.getCMPFields().iterator(); i.hasNext(); ) {
JDBCCMPFieldMetaData cmpField = (JDBCCMPFieldMetaData)i.next();
  - System.out.println(TableKeyField : 
name=+cmpField.getFieldName()+ isPk=+cmpField.isPrimaryKeyMember());
if(cmpField.isPrimaryKeyMember()) {
cmpField = new JDBCCMPFieldMetaData(entity, cmpField, 
entity.getName() + _ + cmpField.getFieldName(), false);
tableKeyFields.put(cmpField.getFieldName(), cmpField);
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP1xFieldBridge.java JDBCCMP2xFieldBridge.java JDBCEntityBridge.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 20:01:26

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge
JDBCCMP1xFieldBridge.java JDBCCMP2xFieldBridge.java
JDBCEntityBridge.java
  Log:
  Removed passing of log objects, which can be obtained directly from the store 
manager.
  Other minor changed because of changes in the metadata package.
  
  Revision  ChangesPath
  1.3   +4 -4  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP1xFieldBridge.java
  
  Index: JDBCCMP1xFieldBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP1xFieldBridge.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCCMP1xFieldBridge.java 2001/07/09 23:53:57 1.2
  +++ JDBCCMP1xFieldBridge.java 2001/07/26 03:01:26 1.3
  @@ -36,16 +36,16 @@
*   One for each entity bean cmp field. 
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public class JDBCCMP1xFieldBridge extends JDBCAbstractCMPFieldBridge {
protected Field field;

  - public JDBCCMP1xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData 
metadata, Log log) throws DeploymentException {
  - super(manager, metadata, log);
  + public JDBCCMP1xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData 
metadata) throws DeploymentException {
  + super(manager, metadata);
   
try {
  - field = 
metadata.getJDBCEntity().getEntityClass().getField(getFieldName());
  + field = 
manager.getMetaData().getEntityClass().getField(getFieldName());
} catch(NoSuchFieldException e) {
// Non recoverable internal exception
throw new DeploymentException(No field named ' + 
getFieldName() + ' found in entity class.);
  
  
  
  1.3   +8 -3  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP2xFieldBridge.java
  
  Index: JDBCCMP2xFieldBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP2xFieldBridge.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCCMP2xFieldBridge.java 2001/07/09 23:53:57 1.2
  +++ JDBCCMP2xFieldBridge.java 2001/07/26 03:01:26 1.3
  @@ -16,6 +16,7 @@
   
   import org.jboss.ejb.plugins.cmp.CMPStoreManager;
   import org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager;
  +import org.jboss.ejb.plugins.cmp.jdbc.JDBCType;
   import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData;
   
   import org.jboss.logging.Log;
  @@ -33,11 +34,15 @@
*   One for each entity bean cmp field. 
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public class JDBCCMP2xFieldBridge extends JDBCAbstractCMPFieldBridge {
  - public JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData 
metadata, Log log) throws DeploymentException {
  - super(manager, metadata, log);
  + public JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData 
metadata) throws DeploymentException {
  + super(manager, metadata);
  + }
  +
  + public JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData 
metadata, JDBCType jdbcType) throws DeploymentException {
  + super(manager, metadata, jdbcType);
}
   
public Object getInstanceValue(EntityEnterpriseContext ctx) {
  
  
  
  1.4   +14 -14
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCEntityBridge.java
  
  Index: JDBCEntityBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCEntityBridge.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDBCEntityBridge.java 2001/07/09 23:53:57 1.3
  +++ JDBCEntityBridge.java 2001/07/26 03:01:26 1.4
  @@ -51,7 +51,7 @@
*   One per cmp entity bean type.   
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
*/
   public class JDBCEntityBridge implements EntityBridge {
  protected JDBCEntityMetaData metadata;
  @@ -84,14 +84,14 @@
   
protected void loadCMPFields(JDBCEntityMetaData metadata) throws 
DeploymentException {
// map between field names and field objects
  - cmpFieldsByName = new HashMap

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCDeleteRelationsCommand.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 20:04:47

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc
JDBCDeleteRelationsCommand.java
  Log:
  Minor changes due to changes in cmr field api.
  
  Revision  ChangesPath
  1.2   +5 -5  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeleteRelationsCommand.java
  
  Index: JDBCDeleteRelationsCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeleteRelationsCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JDBCDeleteRelationsCommand.java   2001/07/09 23:55:32 1.1
  +++ JDBCDeleteRelationsCommand.java   2001/07/26 03:04:47 1.2
  @@ -15,7 +15,7 @@
* Deletes relations from a relation table.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class JDBCDeleteRelationsCommand
  extends JDBCUpdateCommand
  @@ -51,10 +51,10 @@
RelationPair pair = (RelationPair)pairs.next();
   sql.append(();
// left keys
  - 
sql.append(SQLUtil.getWhereClause(relationData.getLeftCMRField().getKeyFields()));
  + 
sql.append(SQLUtil.getWhereClause(relationData.getLeftCMRField().getTableKeyFields()));
sql.append( AND );
// right keys
  - 
sql.append(SQLUtil.getWhereClause(relationData.getRightCMRField().getKeyFields()));
  + 
sql.append(SQLUtil.getWhereClause(relationData.getRightCMRField().getTableKeyFields()));
   sql.append());

if(pairs.hasNext()) {
  @@ -75,14 +75,14 @@

// left keys
Object leftId = pair.getLeftId();
  - JDBCCMPFieldBridge[] leftKeyFields = 
relationData.getLeftCMRField().getKeyFields();
  + JDBCCMPFieldBridge[] leftKeyFields = 
relationData.getLeftCMRField().getTableKeyFields();
for(int i=0; ileftKeyFields.length; i++) {
parameterIndex = 
leftKeyFields[i].setPrimaryKeyParameters(ps, parameterIndex, leftId);
}

// right keys
Object rightId = pair.getRightId();
  - JDBCCMPFieldBridge[] rightKeyFields = 
relationData.getRightCMRField().getKeyFields();
  + JDBCCMPFieldBridge[] rightKeyFields = 
relationData.getRightCMRField().getTableKeyFields();
for(int i=0; irightKeyFields.length; i++) {
parameterIndex = 
rightKeyFields[i].setPrimaryKeyParameters(ps, parameterIndex, rightId);
}
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/metadata RelationshipRoleMetaData.java

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 20:17:04

  Modified:src/main/org/jboss/metadata RelationshipRoleMetaData.java
  Log:
  Changed constructor to take a back pointer to the relation metadata.
  Added method to obtain the role for the other half of the relation.
  
  Revision  ChangesPath
  1.2   +25 -1 jboss/src/main/org/jboss/metadata/RelationshipRoleMetaData.java
  
  Index: RelationshipRoleMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/metadata/RelationshipRoleMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RelationshipRoleMetaData.java 2001/07/09 20:49:00 1.1
  +++ RelationshipRoleMetaData.java 2001/07/26 03:17:04 1.2
  @@ -14,7 +14,7 @@
* file's ejb-relation elements.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class RelationshipRoleMetaData extends MetaData {
// one is one
  @@ -28,6 +28,11 @@
private String relationshipRoleName;

/**
  +  * The relation to which the role belongs.
  +  */
  +  private RelationMetaData relationMetaData;
  + 
  + /**
 * Multiplicity of role, ONE or MANY.
 */
private int multiplicity;
  @@ -52,6 +57,10 @@
 */
private String cmrFieldType;
   
  + public RelationshipRoleMetaData(RelationMetaData relationMetaData) {
  + this.relationMetaData = relationMetaData;
  + }
  + 
/**
 * Gets the relationship role name
 */
  @@ -59,6 +68,21 @@
return relationshipRoleName;
}
   
  + /**
  +  * Gets the relation meta data to which the role belongs.
  +  * @returns the relation to which the relationship role belongs
  +  */
  + public RelationMetaData getRelationMetaData() {
  + return relationMetaData;
  + }
  + 
  + /**
  +  * Gets the related role's metadata
  +  */
  + public RelationshipRoleMetaData getRelatedRoleMetaData() {
  + return relationMetaData.getOtherRelationshipRole(this);
  + }
  + 
/**
 * Checks if the multiplicity is one.
 */
  
  
  

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



[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjbosscmp-jdbc.xml

2001-07-25 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/25 20:21:05

  Modified:src/etc/conf/default standardjbosscmp-jdbc.xml
  Log:
  Changed default-entity to defaults.
  Moved declaration of datasource and type mapping to defaults to allow overridingof 
the datasource and type mapping on a per bean/relation level.
  
  Revision  ChangesPath
  1.2   +16 -15jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml
  
  Index: standardjbosscmp-jdbc.xml
  ===
  RCS file: /cvsroot/jboss/jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- standardjbosscmp-jdbc.xml 2001/06/24 01:22:32 1.1
  +++ standardjbosscmp-jdbc.xml 2001/07/26 03:21:05 1.2
  @@ -1,18 +1,19 @@
   ?xml version=1.0 encoding=UTF-8?
  -jaws
  -datasourcejava:/DefaultDS/datasource
  -type-mappingHypersonic SQL/type-mapping
  -debugtrue/debug
  -
  -default-entity
  -   create-tabletrue/create-table
  -   remove-tablefalse/remove-table
  -   tuned-updatesfalse/tuned-updates
  -   read-onlyfalse/read-only
  -   time-out300/time-out
  -   select-for-updatefalse/select-for-update
  -/default-entity
  -
  +jbosscmp-jdbc
  + 
  + defaults
  + datasourcejava:/DefaultDS/datasource
  + type-mappingHypersonic SQL/type-mapping
  + debugtrue/debug
  + 
  + create-tabletrue/create-table
  + remove-tablefalse/remove-table
  + read-onlyfalse/read-only
  + time-out300/time-out
  + select-for-updatefalse/select-for-update
  + preferred-relation-mappingforeign-key/preferred-relation-mapping
  + /defaults
  + 
   type-mappings
   type-mapping
   nameInterBase/name
  @@ -1245,4 +1246,4 @@
 /type-mapping 
   
   /type-mappings
  -/jaws
  +/jbosscmp-jdbc
  
  
  

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



[JBoss-dev] CMP 2.x relationships

2001-07-25 Thread Dain Sundstrom

You should now be able to use cmp 2.x relationships.

I finally commit the rest of the relationship code I have been working on.
It took forever because half way throught the change I decided that I didn't
like my metadata package, and had to rewrite it.

If anyone would like to help out with the cmp 2.x project, you can start by
trying to use the relationship code.  There appear to be an infinate number
of possiable configurations a relationship, and my test cases only scratch
the surface. Just using the code should turn up many bugs.

By the end of the week, I will post an updated quick doc which has full
details on how to configure the relationship mapping. I have attached a copy
of the config file to the end of this message for anyone that wants to try
the new code ASAP.

Next, I will start working on the ejb-ql parser.  About a month a go I read
the book Building Parsers with Java and feel like it will be a fairly
simple task.  I also just started The Cathedral  the Bazaar,  which was
an eye opener for me.  I have a long history of cathedral building, and that
is how I have been approaching the cmp 2.x project.  In the future, I hope
to be more open in my developement and will start by committing much smaller
changes.

On a final note, everyone should read Josh Bloch's book Effective Java.
It is the kind of book that I read every couple of years that reminds me how
little I know.

-dain

- - - - - - - - - - Example jbosscmp-jdbc.xml - - - - - - - - - - -

?xml version=1.0 encoding=UTF-8?
jbosscmp-jdbc

 defaults
  datasource/datasource
  debugfalse/debug
  create-tabletrue/create-table
  remove-tabletrue/remove-table
  tuned-updatestrue/tuned-updates
  read-onlyfalse/read-only
  time-out300/time-out
  select-for-updatefalse/select-for-update
  pk-constrainttrue/pk-constraint
  relation-mapping-styleforeign-key/relation-mapping-style
 /defaults

 enterprise-beans
  entity
   ejb-nameCDBean/ejb-name
   table-nameCD/table-name
   cmp-field
field-nameid/field-name
column-nameID_XX/column-name
jdbc-typeVARCHAR/jdbc-type
sql-typeVARCHAR(50)/sql-type
   /cmp-field
   cmp-field
field-nametitle/field-name
column-nameTITLE/column-name
   /cmp-field
   cmp-field
field-nameartist/field-name
column-nameARTIST/column-name
   /cmp-field
   cmp-field
field-nametype/field-name
column-nameTYPE/column-name
   /cmp-field
   cmp-field
field-namenotes/field-name
column-nameNOTES/column-name
   /cmp-field

   eager-load/

   lazy-load-groups
lazy-load-group
 desriptionBlah/desription
 field-nametype/field-name
 field-namenotes/field-name
/lazy-load-group
   /lazy-load-groups

   query
descriptionSearch all fields in cd/description
query-method
 method-namefindInAnyField/method-name
 method-params
  method-paramjava.lang.String/method-param
 /method-params
/query-method
declared-sql
 whereTITLE={0} OR ARTIST={0} OR TYPE={0} OR NOTES={0}/where
/declared-sql
   /query
  /entity

  entity
   ejb-nameUserEJB/ejb-name
   table-nameUSER/table-name
   cmp-field
field-nameuserId/field-name
column-nameUSER_ID/column-name
   /cmp-field
   cmp-field
field-nameinternalId/field-name
column-nameINTERNAL_ID/column-name
   /cmp-field
   cmp-field
field-nameuserName/field-name
property
 property-namefirst/property-name
 column-nameFIRST_NAME/column-name
 jdbc-typeVARCHAR/jdbc-type
 sql-typeVARCHAR(100)/sql-type
/property
property
 property-namemi/property-name
 column-nameMI/column-name
/property
property
 property-namelast/property-name
 column-nameLAST_NAME/column-name
/property
   /cmp-field
   cmp-field
field-nameaddress/field-name
column-nameADDRESS/column-name
   /cmp-field
   cmp-field
field-namecreditCard/field-name
column-nameCREDIT_CARD/column-name
   /cmp-field

   eager-load
field-nameinternalId/field-name
   /eager-load

   lazy-load-groups
lazy-load-group
 desriptionBlah/desription
 field-nameuserName/field-name
 field-namecreditCard/field-name
/lazy-load-group
   /lazy-load-groups
  /entity
 /enterprise-beans

 relationships
  ejb-relation
   ejb-relation-nameCustomer-User/ejb-relation-name
   foreign-key-mapping
ejb-relationship-role

ejb-relationship-role-namecustomer-is-a-user/ejb-relationship-role-name

 foreign-key-fields
  foreign-key-field
   field-nameuserId/field-name
   column-nameUSER_ID/column-name
  /foreign-key-field
 /foreign-key-fields

/ejb-relationship-role

ejb-relationship-role

ejb-relationship-role-nameuser-for-customer/ejb-relationship-role-name

 foreign-key-fields/

/ejb-relationship-role
   /foreign-key-mapping
  /ejb-relation

  ejb-relation
   ejb-relation-nameAB_OneToMany_Bi_Table/ejb-relation-name
   table-mapping
table-nameAB_OneToManyBi/table-name
create-tabletrue/create-table
remove-tabletrue/remove-table

Re: [JBoss-dev] Transactions and Optimization

2001-07-26 Thread Dain Sundstrom

Dan,

In org.jboss.ejb.plugins.jrmp.interfaces.GenericProxy we have the following
code:

protected Object invokeContainer(final Object id,
 final Method method,
 final Object[] args)
throws Throwable
{
Object result;

// optimize if calling another bean in same EJB-application
if (optimize  isLocal()) {
result = container.invoke(id,
  method,
  args,
  getTransaction(),
  getPrincipal(),
  getCredential());
} else {
   ..

So, it calls getTransaction which will return null if there is no current
tx. I think in that case, the tx invocation interceptor creates a new tx.

I'm not sure this helps.

-dain

- Original Message -
From: Dan OConnor [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 26, 2001 11:51 AM
Subject: [JBoss-dev] Transactions and Optimization


 Hi guys,

 I was hoping someone would know where this bug would be as
 soon as I described the symptoms.

 A bean-managed entity registers a synchronization object with a
 transaction. If it is called from a web-tier client with optimizations
 turned on, it fails like this:

 java.lang.IllegalStateException: No transaction.
 at
 org.jboss.tm.TransactionImpl.registerSynchronization(TransactionIm
 pl.java:135)

 If this method is called from a remote client, it always works. If it is
 called from a web-tier client with optimizations turned off, this
 always works. (The transaction attribute of the business method is
 Required.)

 Anyone know the answer?

 -Dan



 ___
 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-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc JDBCFindEntitiesCommand.java JDBCFindEntityCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:14

  Modified:src/main/org/jboss/ejb/plugins/jaws/jdbc
JDBCFindEntitiesCommand.java
JDBCFindEntityCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.11  +2 -6  
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCFindEntitiesCommand.java
  
  Index: JDBCFindEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCFindEntitiesCommand.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JDBCFindEntitiesCommand.java  2001/06/18 14:34:27 1.10
  +++ JDBCFindEntitiesCommand.java  2001/07/26 21:54:14 1.11
  @@ -14,10 +14,6 @@
   import java.util.HashMap;
   import java.util.Iterator;
   
  -import java.rmi.RemoteException;
  -
  -import javax.ejb.FinderException;
  -
   import org.jboss.ejb.EntityEnterpriseContext;
   import org.jboss.ejb.plugins.jaws.JPMFindEntitiesCommand;
   import org.jboss.ejb.plugins.jaws.metadata.FinderMetaData;
  @@ -33,7 +29,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
*/
   public class JDBCFindEntitiesCommand implements JPMFindEntitiesCommand
   {
  @@ -135,7 +131,7 @@
  public FinderResults execute(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 String finderName = finderMethod.getName();
 
  
  
  
  1.8   +2 -4  
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCFindEntityCommand.java
  
  Index: JDBCFindEntityCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCFindEntityCommand.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDBCFindEntityCommand.java2001/06/21 21:56:28 1.7
  +++ JDBCFindEntityCommand.java2001/07/26 21:54:14 1.8
  @@ -12,8 +12,6 @@
   import java.util.Collection;
   import java.util.ArrayList;
   
  -import java.rmi.RemoteException;
  -
   import javax.ejb.FinderException;
   import javax.ejb.ObjectNotFoundException;
   
  @@ -31,7 +29,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
* @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
*
* Revision:
* 20010621 Bill Burke: findByPrimaryKey may now do a read-ahead depending on 
configuration
  @@ -64,7 +62,7 @@
  public Object execute(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 if (finderMethod.getName().equals(findByPrimaryKey))
 {
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp CMPStoreManager.java FindEntitiesCommand.java FindEntityCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:13

  Modified:src/main/org/jboss/ejb/plugins/cmp CMPStoreManager.java
FindEntitiesCommand.java FindEntityCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.3   +3 -3  jboss/src/main/org/jboss/ejb/plugins/cmp/CMPStoreManager.java
  
  Index: CMPStoreManager.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/CMPStoreManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CMPStoreManager.java  2001/07/09 23:59:58 1.2
  +++ CMPStoreManager.java  2001/07/26 21:54:13 1.3
  @@ -61,7 +61,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
* @see org.jboss.ejb.EntityPersistenceStore
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public abstract class CMPStoreManager 
  implements EntityPersistenceStore2
  @@ -172,7 +172,7 @@
  public Object findEntity(Method finderMethod,
   Object[] args,
   EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 return findEntityCommand.execute(finderMethod, args, ctx);
  }
  @@ -180,7 +180,7 @@
  public FinderResults findEntities(Method finderMethod,
 Object[] args,
 EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 return findEntitiesCommand.execute(finderMethod, args, ctx);
  }
  
  
  
  1.2   +2 -3  
jboss/src/main/org/jboss/ejb/plugins/cmp/FindEntitiesCommand.java
  
  Index: FindEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/FindEntitiesCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FindEntitiesCommand.java  2001/06/24 03:23:13 1.1
  +++ FindEntitiesCommand.java  2001/07/26 21:54:13 1.2
  @@ -10,7 +10,6 @@
   import java.util.Collection;
   import java.lang.reflect.Method;
   import org.jboss.ejb.EntityEnterpriseContext;
  -import java.rmi.RemoteException;
   import javax.ejb.FinderException;
   import org.jboss.util.FinderResults;
   
  @@ -25,7 +24,7 @@
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public interface FindEntitiesCommand
   {
  @@ -34,5 +33,5 @@
  public FinderResults execute(Method finderMethod, 
Object[] args, 
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException;
  +  throws Exception;
   }
  
  
  
  1.2   +2 -3  jboss/src/main/org/jboss/ejb/plugins/cmp/FindEntityCommand.java
  
  Index: FindEntityCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/FindEntityCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FindEntityCommand.java2001/06/24 03:23:13 1.1
  +++ FindEntityCommand.java2001/07/26 21:54:13 1.2
  @@ -9,7 +9,6 @@
   
   import java.lang.reflect.Method;
   import org.jboss.ejb.EntityEnterpriseContext;
  -import java.rmi.RemoteException;
   import javax.ejb.FinderException;
   
   /**
  @@ -23,7 +22,7 @@
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public interface FindEntityCommand
   {
  @@ -32,5 +31,5 @@
  public Object execute(Method finderMethod, 
Object[] args, 
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException;
  +  throws Exception;
   }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jaws/bmp CustomFindByEntitiesCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:14

  Modified:src/main/org/jboss/ejb/plugins/jaws/bmp
CustomFindByEntitiesCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.5   +11 -11
jboss/src/main/org/jboss/ejb/plugins/jaws/bmp/CustomFindByEntitiesCommand.java
  
  Index: CustomFindByEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/bmp/CustomFindByEntitiesCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CustomFindByEntitiesCommand.java  2001/07/23 04:23:02 1.4
  +++ CustomFindByEntitiesCommand.java  2001/07/26 21:54:14 1.5
  @@ -30,7 +30,7 @@
*
* @see org.jboss.ejb.plugins.jaws.jdbc.JDBCFindEntitiesCommand
* @author a href=mailto:[EMAIL PROTECTED];Michel de Groot/a
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*/
   public class CustomFindByEntitiesCommand
  implements JPMFindEntitiesCommand
  @@ -66,9 +66,8 @@
  public FinderResults execute(Method finderMethod,
   Object[] args,
   EntityEnterpriseContext ctx)
  -  throws java.rmi.RemoteException, FinderException
  +  throws Exception
  {
  -  FinderResults result = null;
   
 // invoke implementation method on ejb instance
 try {
  @@ -76,23 +75,24 @@
// if expected return type is not Collection, wrap result in Collection
if (finderMethod.getReturnType().equals(Collection.class))  {
   Collection coll = 
(Collection)finderImplMethod.invoke(ctx.getInstance(),args);
  -result = new FinderResults(coll, null, null, null);
  +return new FinderResults(coll, null, null, null);
} else {
   Collection coll = new ArrayList(1);
   coll.add(finderImplMethod.invoke(ctx.getInstance(),args));
  -result = new FinderResults(coll, null, null, null);
  +return new FinderResults(coll, null, null, null);
}
 } catch (IllegalAccessException e1) {
throw new FinderException(Unable to access finder 
implementation:+finderImplMethod.getName());
 } catch (IllegalArgumentException e2) {
throw new FinderException(Illegal arguments for finder 
implementation:+finderImplMethod.getName());
  -  } catch (InvocationTargetException e3) {
  - throw new FinderException(Exception in finder 
implementation:+finderImplMethod.getName());
 } catch (ExceptionInInitializerError e5) {
throw new FinderException(Unable to initialize finder 
implementation:+finderImplMethod.getName());
  -  }
  -
  -  return result;
  + } catch (InvocationTargetException e) {
  + Throwable target  = e.getTargetException();
  + if(target instanceof Exception) {
  + throw (Exception)target;
  + }
  + throw new FinderException(Unable to initialize finder 
implementation:  + finderImplMethod.getName());
  + }
  }
  -
   }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/bmp CustomFindByEntitiesCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:13

  Modified:src/main/org/jboss/ejb/plugins/cmp/bmp
CustomFindByEntitiesCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.2   +9 -7  
jboss/src/main/org/jboss/ejb/plugins/cmp/bmp/CustomFindByEntitiesCommand.java
  
  Index: CustomFindByEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/bmp/CustomFindByEntitiesCommand.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CustomFindByEntitiesCommand.java  2001/06/24 03:23:14 1.1
  +++ CustomFindByEntitiesCommand.java  2001/07/26 21:54:13 1.2
  @@ -31,7 +31,7 @@
*
* @see org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntitiesCommand
* @author a href=mailto:[EMAIL PROTECTED];Michel de Groot/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class CustomFindByEntitiesCommand implements FindEntitiesCommand {
// Attributes 
  @@ -59,7 +59,7 @@
public FinderResults execute(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx)
  - throws java.rmi.RemoteException, FinderException
  + throws Exception
{
try {
// invoke implementation method on ejb instance
  @@ -71,13 +71,15 @@
result = Collections.singleton(result);
}
return new FinderResults((Collection)result, null, null, null);
  - } catch (IllegalAccessException e1) {
  + } catch (IllegalAccessException e) {
throw new FinderException(Unable to access finder 
implementation:  + finderImplMethod.getName());
  - } catch (IllegalArgumentException e2) {
  + } catch (IllegalArgumentException e) {
throw new FinderException(Illegal arguments for finder 
implementation:  + finderImplMethod.getName());
  - } catch (InvocationTargetException e3) {
  - throw new FinderException(Exception in finder implementation: 
 + finderImplMethod.getName());
  - } catch (ExceptionInInitializerError e5) {
  + } catch (InvocationTargetException e) {
  + Throwable target  = e.getTargetException();
  + if(target instanceof Exception) {
  + throw (Exception)target;
  + }
throw new FinderException(Unable to initialize finder 
implementation:  + finderImplMethod.getName());
}
}
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/jaws JAWSPersistenceManager.java JPMFindEntitiesCommand.java JPMFindEntityCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:14

  Modified:src/main/org/jboss/ejb/plugins/jaws
JAWSPersistenceManager.java
JPMFindEntitiesCommand.java
JPMFindEntityCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.30  +3 -3  
jboss/src/main/org/jboss/ejb/plugins/jaws/JAWSPersistenceManager.java
  
  Index: JAWSPersistenceManager.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/JAWSPersistenceManager.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- JAWSPersistenceManager.java   2001/07/09 23:21:28 1.29
  +++ JAWSPersistenceManager.java   2001/07/26 21:54:14 1.30
  @@ -39,7 +39,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.29 $
  + * @version $Revision: 1.30 $
*/
   public class JAWSPersistenceManager
  implements EntityPersistenceStore
  @@ -132,7 +132,7 @@
  public Object findEntity(Method finderMethod,
   Object[] args,
   EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 return findEntityCommand.execute(finderMethod, args, ctx);
  }
  @@ -140,7 +140,7 @@
  public FinderResults findEntities(Method finderMethod,
 Object[] args,
 EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException
  +  throws Exception
  {
 return findEntitiesCommand.execute(finderMethod, args, ctx);
  }
  
  
  
  1.4   +2 -4  
jboss/src/main/org/jboss/ejb/plugins/jaws/JPMFindEntitiesCommand.java
  
  Index: JPMFindEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/JPMFindEntitiesCommand.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JPMFindEntitiesCommand.java   2001/05/27 00:49:15 1.3
  +++ JPMFindEntitiesCommand.java   2001/07/26 21:54:14 1.4
  @@ -10,15 +10,13 @@
   import java.util.Collection;
   import java.lang.reflect.Method;
   import org.jboss.ejb.EntityEnterpriseContext;
  -import java.rmi.RemoteException;
  -import javax.ejb.FinderException;
   import org.jboss.util.FinderResults;
   
   /**
* Interface for JAWSPersistenceManager FindEntities Command.
*  
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
*/
   public interface JPMFindEntitiesCommand
   {
  @@ -27,5 +25,5 @@
  public FinderResults execute(Method finderMethod, 
Object[] args, 
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException;
  +  throws Exception;
   }
  
  
  
  1.3   +2 -4  
jboss/src/main/org/jboss/ejb/plugins/jaws/JPMFindEntityCommand.java
  
  Index: JPMFindEntityCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/jaws/JPMFindEntityCommand.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JPMFindEntityCommand.java 2000/12/07 15:44:30 1.2
  +++ JPMFindEntityCommand.java 2001/07/26 21:54:14 1.3
  @@ -9,14 +9,12 @@
   
   import java.lang.reflect.Method;
   import org.jboss.ejb.EntityEnterpriseContext;
  -import java.rmi.RemoteException;
  -import javax.ejb.FinderException;
   
   /**
* Interface for JAWSPersistenceManager FindEntity Command.
*  
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public interface JPMFindEntityCommand
   {
  @@ -25,5 +23,5 @@
  public Object execute(Method finderMethod, 
Object[] args, 
EntityEnterpriseContext ctx)
  -  throws RemoteException, FinderException;
  +  throws Exception;
   }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindEntitiesCommand.java JDBCFindEntityCommand.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 14:54:14

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc
JDBCFindEntitiesCommand.java
JDBCFindEntityCommand.java
  Log:
  Changed finders to allow application exceptions to be passed back to clients
  instead of being wrapped in a FinderException.  This is required by the spec.
  
  The changes is based on patch #437132.
  
  Revision  ChangesPath
  1.4   +2 -2  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindEntitiesCommand.java
  
  Index: JDBCFindEntitiesCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindEntitiesCommand.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDBCFindEntitiesCommand.java  2001/07/26 03:06:40 1.3
  +++ JDBCFindEntitiesCommand.java  2001/07/26 21:54:14 1.4
  @@ -36,7 +36,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
*/
   public class JDBCFindEntitiesCommand implements FindEntitiesCommand {
// Attributes 
  @@ -126,7 +126,7 @@
public FinderResults execute(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx)
  - throws RemoteException, FinderException
  + throws Exception
{   
FindEntitiesCommand finderCommand =

(FindEntitiesCommand)knownFinderCommands.get(finderMethod);
  
  
  
  1.3   +2 -2  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindEntityCommand.java
  
  Index: JDBCFindEntityCommand.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindEntityCommand.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCFindEntityCommand.java2001/07/09 23:55:32 1.2
  +++ JDBCFindEntityCommand.java2001/07/26 21:54:14 1.3
  @@ -30,7 +30,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
* @author a href=mailto:[EMAIL PROTECTED];Joe Shevland/a
* @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public class JDBCFindEntityCommand implements FindEntityCommand {
  // Attributes 
  @@ -50,7 +50,7 @@
public Object execute(Method finderMethod,
Object[] args,
EntityEnterpriseContext ctx)
  - throws RemoteException, FinderException {
  + throws Exception {
   
if(finderMethod.getName().equals(findByPrimaryKey)) {
return findByPrimaryKey(args[0]);
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/metadata QueryMetaData.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 15:09:41

  Modified:src/main/org/jboss/metadata QueryMetaData.java
  Log:
  Applied patch 444395. This fixes a bug where the optional element method-intf
  was required.
  
  Revision  ChangesPath
  1.2   +2 -3  jboss/src/main/org/jboss/metadata/QueryMetaData.java
  
  Index: QueryMetaData.java
  ===
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/metadata/QueryMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- QueryMetaData.java2001/06/24 01:06:16 1.1
  +++ QueryMetaData.java2001/07/26 22:09:41 1.2
  @@ -17,7 +17,7 @@
* Contains information about ejb-ql queries.
* 
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public class QueryMetaData extends MetaData {
// Constants -
  @@ -81,8 +81,7 @@

// method interface
methodIntf = getElementContent(getOptionalChild(queryMethod, 
method-intf));
  - if(!HOME.equals(methodIntf) 
  - !LOCAL_HOME.equals(methodIntf)) {
  + if(methodIntf!=null  !HOME.equals(methodIntf)  
!LOCAL_HOME.equals(methodIntf)) {
throw new DeploymentException(result-type-mapping must be ' 
+ 
HOME + ', ' + 
LOCAL_HOME + ', if 
specified);
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCQueryMetaDataFactory.java

2001-07-26 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/07/26 15:24:29

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCQueryMetaDataFactory.java
  Log:
  Applied patch 22. This fixes a bug where it was assumed that a bean
  always had a home and local home interface, which are optional in ejb 2.x
  
  Revision  ChangesPath
  1.3   +10 -4 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQueryMetaDataFactory.java
  
  Index: JDBCQueryMetaDataFactory.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQueryMetaDataFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDBCQueryMetaDataFactory.java 2001/07/26 02:39:33 1.2
  +++ JDBCQueryMetaDataFactory.java 2001/07/26 22:24:29 1.3
  @@ -22,7 +22,7 @@
* on the query specifiection type.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - *   @version $Revision: 1.2 $
  + *   @version $Revision: 1.3 $
*/
   public class JDBCQueryMetaDataFactory {
private JDBCEntityMetaData entity;
  @@ -88,7 +88,7 @@
  public Method[] getQueryMethods(QueryMetaData queryData) throws 
DeploymentException {
String methodName = queryData.getMethodName();
Class[] parameters = convertToJavaClasses(queryData.getMethodParams());
  - String methodIntf = queryData.getMethodName();
  + String methodIntf = queryData.getMethodIntf();
return getQueryMethods(methodName, parameters, methodIntf);
}
   
  @@ -103,9 +103,15 @@
} else {
// interface element
if(methodIntf == null || 
methodIntf.equals(QueryMetaData.HOME)) {
  - methods.add(getQueryMethod(methodName, parameters, 
entity.getHomeClass()));
  + Class homeClass = entity.getHomeClass(); // optional, 
might be null
  + if(homeClass != null) {
  + methods.add(getQueryMethod(methodName, 
parameters, homeClass));
  + }
} else if(methodIntf == null || 
methodIntf.equals(QueryMetaData.LOCAL_HOME)) {
  - methods.add(getQueryMethod(methodName, parameters, 
entity.getLocalHomeClass()));
  + Class localHomeClass = entity.getLocalHomeClass(); // 
optional, might be null
  + if(localHomeClass != null) {
  + methods.add(getQueryMethod(methodName, 
parameters, localHomeClass));
  + }
}
}  
   
  
  
  

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



Re: [JBoss-dev] jboss daily test results

2001-07-26 Thread Dain Sundstrom

You know the philosophy scratch your own itch.  SF is open source.

- Original Message -
From: Jason Dillon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 26, 2001 5:15 PM
Subject: Re: [JBoss-dev] jboss daily test results


  The SF people are very resonable and would most likely allow us to do
this.

 I wish they would fix the mailing list search... =(

 I have sent more than one request and even exchanged a few emails on the
 side with one of there admin's and it is still broken.

 --jason


 ___
 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] Multiple CMP 2.x relationships to the same bean

2001-08-01 Thread Dain Sundstrom

Stephen,

This should really be posted to the JBossCMP list.

Here is a copy of a message I sent to a user on the that list that had a
similar problem:
---
Liam,

Here is an example:

ejb-relation
ejb-relation-nameAB_OneToMany_Bi_FK/ejb-relation-name
foreign-key-mapping
ejb-relationship-role

ejb-relationship-role-nameA-has-Bs/ejb-relationship-role-name

foreign-key-fields/

/ejb-relationship-role

ejb-relationship-role

ejb-relationship-role-nameB-belongsto-A/ejb-relationship-role-name

foreign-key-fields
foreign-key-field
field-nameid/field-name
column-nameA_ID_PK/column-name
/foreign-key-field
/foreign-key-fields

/ejb-relationship-role
/foreign-key-mapping
/ejb-relation

In this example, A has many Bs.  The A table will not contain any foreign
keys and the B table will have a foreign key for A's pk. The foreign key
column will be named A_ID_PK.
---

You put this in your jbosscmp-jdbc.xml file. If you are not familar with
this file send me a personal email and I will send you the full example from
my test code.

I will be finishing docs on how to configure relationships in ejb 2.0 soon,
but I will be working on a short contract starting tomorrow.  This means
don't expect to see anything until next week.

-dain

 - Original Message -
From: Stephen Lewis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 01, 2001 4:53 AM
Subject: [JBoss-dev] Multiple CMP 2.x relationships to the same bean


 We have an entity bean for airline fares, each of which relates to two
 airports (departure and destination). We have tried to describe these
 relationships using the CMP 2.x features, by specifying two ejb-relations,
 fare-departureairport and fare-destinationairport, in the ejb-jar.xml
 file.

 The CMP code tries to name both of the foreign key columns in the Fare
 table airport_code, hence the creation of the fare table fails. We have
 tried overriding the column names in jbosscmp-jdbc.xml with no success. I
 have attached an excerpt from our ejb-jar.xml; any pointers gratefully
 received :)

 Stephen Lewis

   ejb-relation
ejb-relation-namefare-departureairport/ejb-relation-name
ejb-relationship-role


ejb-relationship-role-namefare-has-departureairport/ejb-relationship-role
 -name
 multiplicityMany/multiplicity
 relationship-role-source
  ejb-nameFare/ejb-name
 /relationship-role-source
 cmr-field
  cmr-field-namedepartureAirport/cmr-field-name
 /cmr-field
/ejb-relationship-role
ejb-relationship-role


ejb-relationship-role-namedepartureairport-belongs-to-fares/ejb-relations
 hip-role-name
 multiplicityOne/multiplicity
 relationship-role-source
  ejb-nameAirport/ejb-name
 /relationship-role-source
/ejb-relationship-role
   /ejb-relation
   ejb-relation
ejb-relation-namefare-destinationairport/ejb-relation-name
ejb-relationship-role


ejb-relationship-role-namefare-has-destinationairport/ejb-relationship-ro
 le-name
 multiplicityMany/multiplicity
 relationship-role-source
  ejb-nameFare/ejb-name
 /relationship-role-source
 cmr-field
  cmr-field-namedestinationAirport/cmr-field-name
 /cmr-field
/ejb-relationship-role
ejb-relationship-role


ejb-relationship-role-namedestinationairport-belongs-to-fares/ejb-relatio
 nship-role-name
 multiplicityOne/multiplicity
 relationship-role-source
  ejb-nameAirport/ejb-name
 /relationship-role-source
/ejb-relationship-role
   /ejb-relation
  /relationships


 ___
 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] Apparent bug in Verifier - static inner classes as valid RMI/IIOP types

2001-08-03 Thread Dain Sundstrom

Luke,

In general, it is not really to use an innerclass as a type in a public api.
In EJB it is a worse Idea.  I think the verifier is complaining that your
class is not serializable.  On page 217 of Josh Block's book Effective Java
her states Inner classes should rarely, if ever, implement Serializable.
He then goes on to explain the synthetic fields generated by the compiler,
and concludes with Therefore, the default serialized form of an inner class
is ill-defined. A static memeber class can, however, implement Serializable
[because it doesn't have synthetic fields]

I looks like you are implementing the Value Object Pattern, and I would
recomend sepperate class for the Value Object.  If you leave it in your bean
impl class you will have to distribute the bean impl to all you clients, and
you will be unable to swap a new implementation into your app.

-dain
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 03, 2001 9:59 AM
Subject: [JBoss-dev] Apparent bug in Verifier - static inner classes as
valid RMI/IIOP types


Hi all,

Can't get any access to Sourceforge so posting here instead...

I tried moving a value data bean (AgentData) into the interface for the
entity bean that it represents and the verifier
(jboss_2.2.2_tomcat_2.2.2) doesn't seem to approve, with messages along
the lines of:

[Verifier]
Bean   : UserManager
Method : public abstract Agent$Data getAgentData(String) throws
RemoteException
Section: 6.10.5
Warning: The method return values in the remote interface must be of
valid types
for RMI/IIOP.

I think it must be falling foul of the following lines in
AbstractVerifier.java:

/*
* If class is a non-static inner class then its containing
class must
* also be a conforming RMI/IDL value type.
*
* Spec 2.8.4 (3)
*/
if (type.getDeclaringClass() != null  isStatic(type))
if (!isRMIIDLValueType(type.getDeclaringClass()))
return false;

which, if the comment is correct should probably read !isStatic(type)
instead ???

Luke.

--
Neu: sunrise hat jetzt noch günstigere Surfpreise!
Sofort profitieren!  http://go.sunrise.ch/de/promo1



___
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] The Remove Problem

2001-08-04 Thread Dain Sundstrom

 |Never mind my comments.  I just reused the TxEntityMap object.
 
 right the one in the interceptor, do you still plan on using the
 application thingy you mentioned earlier?

Yep.

 commit commit!

got to goto a wedding.  I'll make the change and commit it tomorrow.

-dain
 
 marcf
 |
 |-dain
 |
 |- Original Message -
 |From: Dain Sundstrom [EMAIL PROTECTED]
 |To: [EMAIL PROTECTED]
 |Sent: Friday, August 03, 2001 12:53 PM
 |Subject: Re: [JBoss-dev] The Remove Problem
 |
 |
 ||Here is my plan. In the EntitySynchronizationInterceptor
 |instead of
 |   storing
 ||the entities in the tx in a hash in its container, 
 I will store
 ||all entities
 ||in the tx in the application object. Then when a find method
 |   or a remove
 |   
 |what application object, the way bill has it in 
 the container
 |   is fine by
 |me for now but you can justify?
 |  
 |   org.jboss.ejb.Application The reason for the application object
 |   is that An
 |   Application represents a collection of beans that are 
 deployed as a
 | unit.
 |   This seams like a logical place.  The reason Container doesn't
 |   work is that
 |   Container holds only one type of bean, and I'm 
 proposing a place
 |   to register
 |   all entities of any type. We can't use container 
 because we wouldn't
 | know
 |   which container to goto.
 |  
 |   On other possibility it to have an application level 
 registration of
 |the
 |   containers in the tx, and continue to use the container
 |   registration for its
 |   entities.  I don't like this because I think a central 
 repository
 |   is easier
 |   to use.
 |  
 | 
 |  I think this would be cool for other reasons as well.  
 I'm imagining a
 | nice
 |  management gui that, in real-time, shows the entire transactional
 |activity
 |  of JBoss.
 | 
 |
 | That is a cool idea, but implies that everything is 
 totally thread safe.
 |I
 | was planing on having only the get me a collection of the 
 entities in
 |this
 | tx  be thread safe (required) but after that have it assume single
 |threaded
 | (only one thread executing per tx). I'll make all the 
 collections thread
 | safe. It is not a big deal and has insignificant overhead.
 |
 | -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
 

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



Re: [JBoss-dev] Apparent bug in Verifier - static inner classes as valid RMI/IIOP types

2001-08-05 Thread Dain Sundstrom

 Hmmm. I'm not sure I agree entirely:

 1. the value object is effectively part of the interface because it is
 what is returned by the getData methods etc. So the client has to have
 access to it and I don't see anything drastically wrong with having the
 data bean as an inner class of the remote *interface* since it is
 inherently linked to it and used - I didn't say anything about it being
 part of the bean impl class.

 2. The class is static and serializable - all I did was move an
 existing value object into the interface, as a housekeeping issue to
 avoid excessive clutter in my interfaces package. It works fine even
 with a standalone client (i.e. not just from an in-process web
 container where serialization may not be necessary).

 3. In any case, whatever the arguments about the design issues, the
 comment in AbstractVerifier says it is checking If class is a
 *non*-static inner class then ... but the code applies the condition
 if isStatic(type) is true, so my comments about the possible bug here
 still seem valid ...

 Luke.


I stand corrected.  I just assumed that you defined the class in the bean
impl.  I still wouldn't recoment it just because if find it anoying to type
Parrent.InnerClass return type. It looks like the verifier is wrong in this
case, but I cant be certain as I have not read the 1.1 spec in detail.

-dain


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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb Application.java EntityContainer.java

2001-08-05 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/05 12:32:19

  Modified:src/main/org/jboss/ejb Application.java EntityContainer.java
  Log:
  Fixed remove problem.
  * Moved tx entity map to application
  * Moved synchronize entities in tx method to application
  * Moved sync call to entity container find and remove methods
  
  Revision  ChangesPath
  1.14  +36 -1 jboss/src/main/org/jboss/ejb/Application.java
  
  Index: Application.java
  ===
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Application.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Application.java  2001/08/03 17:15:43 1.13
  +++ Application.java  2001/08/05 19:32:19 1.14
  @@ -7,12 +7,14 @@
   package org.jboss.ejb;
   
   import java.net.URL;
  +import java.rmi.RemoteException;
   import java.util.Iterator;
   import java.util.Collection;
   import java.util.HashMap;
   import java.util.Hashtable;
   
   import javax.ejb.EJBLocalHome;
  +import javax.transaction.Transaction;
   
   import org.jboss.util.Service;
   
  @@ -23,7 +25,7 @@
*   @see Container
*   @see ContainerFactory
*   @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a
  - *   @version $Revision: 1.13 $
  + *   @version $Revision: 1.14 $
*/
   public class Application
implements Service
  @@ -45,6 +47,13 @@
  // url where this application was deployed from
  URL url;
  
  +   /**
  +* This provides a way to find the entities that are part of a given
  +* transaction EntitySynchronizationInterceptor and InstanceSynchronization
  +* manage this instance.
  +*/
  +   private TxEntityMap txEntityMap = new TxEntityMap();
  +
  // Static 
   
  // Public 
  @@ -185,6 +194,32 @@
name = url.toString();
  }

  + /**
  +  * Gets the transaction to entity map object, which contains a map from 
  +  * a transaction to every entity used in that transaction.
  +  * @return the transaction to entity map for this application
  +  */
  +   public TxEntityMap getTxEntityMap() {
  +  return txEntityMap;
  +   }
  +
  +   /**
  +* Stores all of the entities associated with the specified transaction.
  +  * @param tx the transaction that associated entites will be stored
  +  * @throws Exception if an problem occures while storing the entities
  +*/
  +   public void synchronizeEntitiesWithinTransaction(Transaction tx) throws 
RemoteException {
  + // If there is no transaction, there is nothing to synchronize.
  + if(tx != null) {
  + Object[] entities = getTxEntityMap().getEntities(tx);
  + for (int i = 0; i  entities.length; i++) {
  + EntityEnterpriseContext ctx = 
(EntityEnterpriseContext)entities[i];
  + EntityContainer container = 
(EntityContainer)ctx.getContainer();
  + container.getPersistenceManager().storeEntity(ctx);
  + }
  + }
  +   }
  +   
// Service implementation 
   
   /**
  
  
  
  1.49  +18 -14jboss/src/main/org/jboss/ejb/EntityContainer.java
  
  Index: EntityContainer.java
  ===
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- EntityContainer.java  2001/08/03 17:15:43 1.48
  +++ EntityContainer.java  2001/08/05 19:32:19 1.49
  @@ -46,7 +46,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Daniel OConnor/a
* @author a href=[EMAIL PROTECTED]Bill Burke/a
* @author a href=mailto:[EMAIL PROTECTED];Andreas Schaefer/a
  - * @version $Revision: 1.48 $
  + * @version $Revision: 1.49 $
*
* pbRevisions:/b
*
  @@ -98,13 +98,6 @@
  protected InstancePool instancePool;
   
  /**
  -* This provides a way to find the entities that are part of a given
  -* transaction EntitySynchronizationInterceptor and InstanceSynchronization
  -* manage this instance.
  -*/
  -   protected TxEntityMap txEntityMap = new TxEntityMap();
  -
  -   /**
   * This is the first interceptor in the chain. The last interceptor must
   * be provided by the container itself.
   */
  @@ -168,11 +161,6 @@
 return persistenceManager;
  }
   
  -   public TxEntityMap getTxEntityMap()
  -   {
  -  return txEntityMap;
  -   }
  -
  public void setPersistenceManager(EntityPersistenceManager pm)
  {
 if (pm == null)
  @@ -397,6 +385,10 @@
  public void remove(MethodInvocation mi)
 throws RemoteException, RemoveException
  {
 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins EntitySynchronizationInterceptor.java

2001-08-05 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/05 12:32:19

  Modified:src/main/org/jboss/ejb/plugins
EntitySynchronizationInterceptor.java
  Log:
  Fixed remove problem.
  * Moved tx entity map to application
  * Moved synchronize entities in tx method to application
  * Moved sync call to entity container find and remove methods
  
  Revision  ChangesPath
  1.48  +594 -616  
jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java
  
  Index: EntitySynchronizationInterceptor.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/EntitySynchronizationInterceptor.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- EntitySynchronizationInterceptor.java 2001/08/03 20:11:25 1.47
  +++ EntitySynchronizationInterceptor.java 2001/08/05 19:32:19 1.48
  @@ -1,616 +1,594 @@
  -/**
  -* JBoss, the OpenSource J2EE webOS
  -*
  -* Distributable under LGPL license.
  -* See terms of license at gnu.org.
  -*/
  -package org.jboss.ejb.plugins;
  -
  -import java.lang.reflect.Method;
  -import java.rmi.RemoteException;
  -import java.rmi.ServerException;
  -import java.util.Map;
  -import java.util.HashMap;
  -import java.util.ArrayList;
  -import java.util.HashSet;
  -
  -import javax.ejb.EJBObject;
  -import javax.ejb.CreateException;
  -import javax.ejb.EJBException;
  -import javax.ejb.NoSuchEntityException;
  -import javax.ejb.RemoveException;
  -import javax.ejb.EntityBean;
  -import javax.transaction.Status;
  -import javax.transaction.Synchronization;
  -import javax.transaction.Transaction;
  -import javax.transaction.TransactionManager;
  -import javax.transaction.RollbackException;
  -import javax.transaction.SystemException;
  -
  -import org.jboss.ejb.BeanLock;
  -import org.jboss.ejb.BeanLockManager;
  -import org.jboss.ejb.Container;
  -import org.jboss.ejb.EntityContainer;
  -import org.jboss.ejb.EntityPersistenceManager;
  -import org.jboss.ejb.EntityEnterpriseContext;
  -import org.jboss.ejb.EnterpriseContext;
  -import org.jboss.ejb.InstanceCache;
  -import org.jboss.ejb.InstancePool;
  -import org.jboss.ejb.MethodInvocation;
  -import org.jboss.metadata.ConfigurationMetaData;
  -import org.jboss.logging.log4j.JBossCategory;
  -import org.jboss.util.Sync;
  -
  -/**
  - * The role of this interceptor is to synchronize the state of the cache with
  - * the underlying storage.  It does this with the ejbLoad and ejbStore
  - * semantics of the EJB specification.  In the presence of a transaction this
  - * is triggered by transaction demarcation. It registers a callback with the
  - * underlying transaction monitor through the JTA interfaces.  If there is no
  - * transaction the policy is to store state upon returning from invocation.
  - * The synchronization polices A,B,C of the specification are taken care of
  - * here.
  - *
  - * pbWARNING: critical code/b, get approval from senior developers
  - *before changing.
  - *
  - * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a
  - * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a
  - * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
  - * @version $Revision: 1.47 $
  - *
  - * pbRevisions:/bbr
  - * pb2001/06/28: marcf/b
  - * ol
  - *   liMoved to new synchronization
  - *   liafterCompletion doesn't return to pool anymore, idea is to simplify
  - *   design by not mucking with reuse of the instances
  - *   libefore completion checks for a rolledback tx and doesn't call the
  - *   store in case of a rollback we are notified but we don't register
  - *   the resource
  - * /ol
  - * pb2001/07/12: starksm/b
  - * ol
  - *   liFixed invalid use of the ctx.transaction in beforeCompletion
  - *   liAdded clearContextTx to make sure clean up of ctx.tx was done consistently
  - *   liClean up the EntityContainer cast-fest
  - * /ol
  - * pb2001/07/26: billb/b
  - * ol
  - *   liLocking is now separate from EntityEnterpriseContext objects and is now
  - *   encapsulated in BeanLock and BeanLockManager.  Did this because the lifetime
  - *   of an EntityLock is sometimes longer than the lifetime of the ctx.
  - * /ol
  - * pb2001/08/01: marcf/b
  - * ol
  - *   liUpdated BeanLock to work in new interceptor and out of InstanceInterceptor 
so we update
  - *   here as well to use the new interceptor lock logic and the BeanLock that bill 
introduced
  - *   liMake use of clearContextTx in all exceptional cases
  - * /ol
  - * pb2001/08/02: marcf/b
  - * ol
  - *   liMoved policy to pluggable framework. Work through the interface of the 
lock only
  - *   Use of endTransaction and wontSynchronize to communicate with the lock
  - * /ol
  - */
  -public class EntitySynchronizationInterceptor
  -   extends AbstractInterceptor
  -{
  -   // Constants -
  - 
  -   // Attributes 

Re: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb ApplicationTxEntityMap.java TxEntityMap.java EntityContainer.java Application.java

2001-08-06 Thread Dain Sundstrom

 Bill, why this change?


- Original Message -
From: Bill Burke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 11:26 AM
Subject: [JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb
ApplicationTxEntityMap.java TxEntityMap.java EntityContainer.java
Application.java


   User: patriot1burke
   Date: 01/08/06 09:26:28

   Modified:src/main/org/jboss/ejb TxEntityMap.java
EntityContainer.java
 Application.java
   Added:   src/main/org/jboss/ejb ApplicationTxEntityMap.java
   Log:
   - put TxEntityMap back into EntityContainer
   - added ApplicationTxEntityMap to Application.  This class returns a
list of entites
   involved with a transaction in the specific order in which they were
accessed.

   Revision  ChangesPath
   1.4   +45 -28jboss/src/main/org/jboss/ejb/TxEntityMap.java

   Index: TxEntityMap.java
   ===
   RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/TxEntityMap.java,v
   retrieving revision 1.3
   retrieving revision 1.4
   diff -u -r1.3 -r1.4
   --- TxEntityMap.java 2001/08/03 17:15:43 1.3
   +++ TxEntityMap.java 2001/08/06 16:26:27 1.4
   @@ -8,6 +8,9 @@

import java.util.HashMap;
import javax.transaction.Transaction;
   +import javax.transaction.RollbackException;
   +import javax.transaction.SystemException;
   +import javax.transaction.Synchronization;

/**
 * This class provides a way to find out what entities are contained in
   @@ -16,7 +19,16 @@
 * Used in EntitySynchronizationInterceptor.
 *
 * @author a href=[EMAIL PROTECTED]Bill Burke/a
   - * @version $Revision: 1.3 $
   + * @version $Revision: 1.4 $
   + *
   + * Revisions:
   + *
   + * pbRevisions:/bbr
   + * pb2001/08/06: marcf/b
   + * ol
   + *   liGot rid of disassociate and added a
javax.transaction.Synchronization.  The sync will clean up the map now.
   + *   liThis class now interacts with ApplicationTxEntityMap available
in Application
   + * /ol
 */
public class TxEntityMap
{
   @@ -26,50 +38,55 @@
* associate entity with transaction
*/
   public synchronized void associate(Transaction tx,
   -  EntityEnterpriseContext entity)
   +  EntityEnterpriseContext entity)
throws RollbackException, SystemException
   {
  HashMap entityMap = (HashMap)m_map.get(tx);
  if (entityMap == null)
  {
 entityMap = new HashMap();
 m_map.put(tx, entityMap);
   + tx.registerSynchronization(new TxEntityMapCleanup(this, tx));
  }
   +
entity.getContainer().getApplication().getTxEntityMap().associate(tx,
entity);
  entityMap.put(entity.getCacheKey(), entity);
   }

   -   /**
   -* Disassociate entity with transaction.  When the transaction has
no
   -* more entities.  it is removed from this class's internal HashMap.
   -*/
   -   public synchronized void disassociate(Transaction tx,
   - EntityEnterpriseContext ctx)
   +   public synchronized EntityEnterpriseContext getCtx(Transaction tx,
   +  CacheKey key)
   {
  HashMap entityMap = (HashMap)m_map.get(tx);
   -  if (entityMap == null)
   +  return (EntityEnterpriseContext)entityMap.get(key);
   +   }
   +
   +   private class TxEntityMapCleanup implements Synchronization
   +   {
   +  TxEntityMap map;
   +  Transaction tx;
   +
   +  public TxEntityMapCleanup(TxEntityMap map,
   +Transaction tx)
  {
   - return;
   + this.map = map;
   + this.tx = tx;
  }
   -  entityMap.remove(ctx.getCacheKey());
   -
   -  // When all entities are gone, cleanup!
   -  // cleanup involves removing the transaction
   -  // from the map
   -  if (entityMap.size() = 0)
   +
   +  // Synchronization implementation -
   +
   +  public void beforeCompletion()
  {
   - m_map.remove(tx);
   + /* complete */
  }
   -   }
   -
   -   /**
   -* get all EntityEnterpriseContext that are involved with a
transaction.
   -*/
   -   public synchronized Object[] getEntities(Transaction tx)
   -   {
   -  HashMap entityMap = (HashMap)m_map.get(tx);
   -  if (entityMap == null) // there are no entities associated
   +
   +  public void afterCompletion(int status)
  {
   - return new Object[0];
   + synchronized(map)
   + {
   +HashMap entityMap = (HashMap)m_map.remove(tx);
   +if (entityMap != null)
   +{
   +   entityMap.clear();
   +}
   + }
  }
   -  return entityMap.values().toArray();
   }
}



   1.50  +11 -4 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql - New directory

2001-08-06 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/06 17:16:58

  jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql - New directory

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



Re: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk remove

2001-08-07 Thread Dain Sundstrom

Mark,

If you remember, I posted to this list the suggested change to the
interceptor, and waited a day after YOU said it was OK to make the change.

As a side note, I was attempting to move the actual store logic out of the
interceptor.  I moved the sync entities in tx to application.  My goal being
to make the interceptor smaller and easier to understand.

-dain

- Original Message -
From: marc fleury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 10:05 AM
Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
remove


 bill,

 between you and I, this is typically the type of problem I want to avoid
 with the core container interceptors.  I know (pretty sure) I didn't miss
 something as basic as that and obviously it wasn't you.  If it is me then
it
 only makes the following point even more true.

 I put you must be this tall to ride the dragon messages in the code but
it
 seems to have no effect in fact it seems to attract more people wanting to
 take the challenge.  You and I know the nightmare that solid synch is (I
 almost went crazy with it) so it *enfuriates* me when someone comes and
 changes it without paying attention.  Can you track down the change (still
 compiling painfully in RH) and let me know and will send a friendly
 reminder privately. :(  It could very well be me because I honestly don't
 remember.

 thanks for being on top of this, I am just tired of going back and back to
 it.  It is a waste of our time.

 we should do it once and for all and then **lock** the 3 classes code in
CVS
 :)

 marcf

 |-Original Message-
 |From: [EMAIL PROTECTED]
 |[mailto:[EMAIL PROTECTED]]On Behalf Of Bill
 |Burke
 |Sent: Tuesday, August 07, 2001 10:34 AM
 |To: [EMAIL PROTECTED]
 |Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
 |remove
 |
 |
 |
 |
 | -Original Message-
 | From: [EMAIL PROTECTED]
 | [mailto:[EMAIL PROTECTED]]On Behalf Of
Jason
 | Dillon
 | Sent: Monday, August 06, 2001 9:19 PM
 | To: [EMAIL PROTECTED]
 | Subject: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
 | remove
 |
 |
 | I am running into a problem with entity bean removal where the
 |pk is null,
 | which causes most everything passed (and including)
 | Application.synchronizeEntitiesWithinTransaction() to fail (called from
 | EntityContainer.remove()).
 |
 |
 |The person who moved synchronizeEntitiesWithinTransaction forgot to
perform
 |that same logic that is EntitySynchronizationInterceptor.storeEntity.  I
 |should have caught this when I reviewed the code.  Sorry, I'll fix it
now.
 |
 |BTW, pk get's set to null when a remove() is called.
 |
 |Bill
 |
 |
 |
 |___
 |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



Re: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk remove

2001-08-07 Thread Dain Sundstrom

marc,

I have simple suggestion.  Can we modify the commit script to check that if
anyone changes the 'special files' it sends an additional message to the
list with the subject 'DANGER' or something simmilar.  Then in the code we
put the comment (in addition to what is already there) mentions that every
one will get a DANGER message and will be very upset if the change was not
approved by marc and bill.

Just an idea.

-dain

- Original Message -
From: marc fleury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 10:51 AM
Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
remove


 |I really disagree on locking the code in cvs.  I'd prefer a solid
 |test suite
 |that tests this stuff backward and forward so that if somebody checks in
 |bogus code, we will know who it is.  We should encourage people to look
at
 |this code.  The more eyes the better this code will be and get.
 |Locking the
 |code in CVS just discourages people from taking a look at it.

 I agree and disagree with your disagreeing.

 disagree: It seems to me that tagging the code as critical in fact attract
 every developer like flies to a lightbulb.  Not good
 agree: I WANT more people to be familiar with it, because as you well know
I
 was on the verge of losing it when I realized that after 8 weeks of work I
 went back to square one with logical steps in between.

 The probability space on that code is a big circle and it is dangerous for
 one's sanity.  I don't want people changing it before graduating to it and
 the only way we can ensure that is by locking the interceptor code since
it
 seems the warnings are not respected?  Otherwise it is I and more recently
 you that have to go down and fix it... nightmare all over again.

 You seem to be more at ease with it than I am and I can't wait to find
time
 to review your N-Lock revision of mine.

 |BTW, I'll fix this stuff as soon as possible(I know the fix), I keep on
 |getting pulled for stuff at the real job.

 great, thanks

 marcf
 |
 |Bill
 |
 | -Original Message-
 | From: [EMAIL PROTECTED]
 | [mailto:[EMAIL PROTECTED]]On Behalf Of marc
 | fleury
 | Sent: Tuesday, August 07, 2001 11:12 AM
 | To: [EMAIL PROTECTED]
 | Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk

 | remove
 |
 |
 | |bill,
 | |
 | |between you and I,
 |
 | It was between Bill and I and then I send the message to everyone.
 |
 | I am not even going to apologize for this since in fact it is better
this
 | way.
 |
 | I will repeat that NO-ONE should touch the interceptor sync stuff (the
3
 | core interceptor classes) without a deep review from top
 |developers first.
 | I really recommend locking the code in cvs if that feature
 |exists.  It was
 | the Locking-waiting buzy wait bug, it was a ton of missed locks it is a
 | nightmare, even for me (who spends most time in it). don't touch
 | it please.
 |
 | So it is better that it is in the open
 |
 | marcf
 |
 | |this is typically the type of problem I want to avoid
 | |with the core container interceptors.  I know (pretty sure) I
 |didn't miss
 | |something as basic as that and obviously it wasn't you.  If it is
 | |me then it
 | |only makes the following point even more true.
 | |
 | |I put you must be this tall to ride the dragon messages in the
 | |code but it
 | |seems to have no effect in fact it seems to attract more people
 | wanting to
 | |take the challenge.  You and I know the nightmare that solid synch is
(I
 | |almost went crazy with it) so it *enfuriates* me when someone comes
and
 | |changes it without paying attention.  Can you track down the
 | change (still
 | |compiling painfully in RH) and let me know and will send a friendly
 | |reminder privately. :(  It could very well be me because I
 | honestly don't
 | |remember.
 | |
 | |thanks for being on top of this, I am just tired of going back
 | and back to
 | |it.  It is a waste of our time.
 | |
 | |we should do it once and for all and then **lock** the 3 classes
 | |code in CVS
 | |:)
 | |
 | |marcf
 | |
 | ||-Original Message-
 | ||From: [EMAIL PROTECTED]
 | ||[mailto:[EMAIL PROTECTED]]On Behalf Of
Bill
 | ||Burke
 | ||Sent: Tuesday, August 07, 2001 10:34 AM
 | ||To: [EMAIL PROTECTED]
 | ||Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction,
 |null pk 
 | ||remove
 | ||
 | ||
 | ||
 | ||
 | || -Original Message-
 | || From: [EMAIL PROTECTED]
 | || [mailto:[EMAIL PROTECTED]]On
 | Behalf Of Jason
 | || Dillon
 | || Sent: Monday, August 06, 2001 9:19 PM
 | || To: [EMAIL PROTECTED]
 | || Subject: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk

 | || remove
 | ||
 | ||
 | || I am running into a problem with entity bean removal where the
 | ||pk is null,
 | || which causes most everything passed (and including)
 | || Application.synchronizeEntitiesWithinTransaction() to fail
 | (called from
 | || EntityContainer.remove()).
 | ||
 | ||
 | ||The person who moved 

Re: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk remove

2001-08-07 Thread Dain Sundstrom

Bill,

Actually, I did run the test. I guess I have it setup wrong.  The bigger
problem with the test package is it doesn't work like a normal JUnit test
suite, so I don't see the there were x failures.  Next time I work on some
thing outside of the cmp package, I look into my setup.

back to the parser

-dain

- Original Message -
From: Bill Burke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 10:51 AM
Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
remove


 Dain,

 The idea was a good one and the code is better for it.  Don't worry about
 it.  Just be more careful next time.  We all make mistakes.  Make sure you
 run jbosstest before you check stuff like this in.  I've just got in the
 habit of this myself.  Also, I've got to start making a list of things to
 test so that we can have good regression tests in jbosstest so introduced
 problems like this show up in the nightly build.

 Bill

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of Dain
  Sundstrom
  Sent: Tuesday, August 07, 2001 11:19 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
  remove
 
 
  Mark,
 
  If you remember, I posted to this list the suggested change to the
  interceptor, and waited a day after YOU said it was OK to make the
change.
 
  As a side note, I was attempting to move the actual store logic out of
the
  interceptor.  I moved the sync entities in tx to application.  My
  goal being
  to make the interceptor smaller and easier to understand.
 
  -dain
 
  - Original Message -
  From: marc fleury [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, August 07, 2001 10:05 AM
  Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk 
  remove
 
 
   bill,
  
   between you and I, this is typically the type of problem I want to
avoid
   with the core container interceptors.  I know (pretty sure) I
  didn't miss
   something as basic as that and obviously it wasn't you.  If it
  is me then
  it
   only makes the following point even more true.
  
   I put you must be this tall to ride the dragon messages in
  the code but
  it
   seems to have no effect in fact it seems to attract more people
  wanting to
   take the challenge.  You and I know the nightmare that solid synch is
(I
   almost went crazy with it) so it *enfuriates* me when someone comes
and
   changes it without paying attention.  Can you track down the
  change (still
   compiling painfully in RH) and let me know and will send a friendly
   reminder privately. :(  It could very well be me because I
  honestly don't
   remember.
  
   thanks for being on top of this, I am just tired of going back
  and back to
   it.  It is a waste of our time.
  
   we should do it once and for all and then **lock** the 3 classes code
in
  CVS
   :)
  
   marcf
  
   |-Original Message-
   |From: [EMAIL PROTECTED]
   |[mailto:[EMAIL PROTECTED]]On Behalf Of
Bill
   |Burke
   |Sent: Tuesday, August 07, 2001 10:34 AM
   |To: [EMAIL PROTECTED]
   |Subject: RE: [JBoss-dev] synchronizeEntitiesWithinTransaction,
  null pk 
   |remove
   |
   |
   |
   |
   | -Original Message-
   | From: [EMAIL PROTECTED]
   | [mailto:[EMAIL PROTECTED]]On Behalf Of
  Jason
   | Dillon
   | Sent: Monday, August 06, 2001 9:19 PM
   | To: [EMAIL PROTECTED]
   | Subject: [JBoss-dev] synchronizeEntitiesWithinTransaction, null pk

   | remove
   |
   |
   | I am running into a problem with entity bean removal where the
   |pk is null,
   | which causes most everything passed (and including)
   | Application.synchronizeEntitiesWithinTransaction() to fail
  (called from
   | EntityContainer.remove()).
   |
   |
   |The person who moved synchronizeEntitiesWithinTransaction forgot to
  perform
   |that same logic that is
  EntitySynchronizationInterceptor.storeEntity.  I
   |should have caught this when I reviewed the code.  Sorry, I'll fix it
  now.
   |
   |BTW, pk get's set to null when a remove() is called.
   |
   |Bill
   |
   |
   |
   |___
   |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
 



 ___
 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] Transition to JCA only - should I commit now?

2001-08-10 Thread Dain Sundstrom

If the licence becomes an issue, I will rewite all added features since the
license change. (After I finish CMP 2.0).

-dain

- Original Message -
From: marc fleury [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 10, 2001 3:03 PM
Subject: RE: [JBoss-dev] Transition to JCA only - should I commit now?


 | Unless you revert back to the last version of Minerva that was
 |included in JBoss, the license for code that currently states that is
 |usees the X license must continue to use the X license - in particular,

 and of course you have got the transfer of copyright from all the
developers
 that helped you on JBoss cvs well documented and sitting tight with your
 lawyer, which would make the change from LGPL to X legal in the first
place.
 :)  Honestly I don't really care, it is compatible

 But yeah new contributions should be LGPL just for uniformity, and I am
not
 about to enforce LGPL abiding on my own contributors.  If you feel
strongly
 David, you can take the minerva code under LGPL and make sure the new JCA
is
 re-written, again I don't feel strongly.

 Thanks

 marcf

 |all of the JCA code was added after the license was changed to X.  New
 |code can of course use LGPL.
 |
 |Aaron
 |
 |
 |___
 |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



Re: [JBoss-dev] what is webOS?

2001-08-13 Thread Dain Sundstrom

IMHO, for 99.999% of uses an XML over a zipped HTTP stream will be
reasonable.

You may ask what is zipped HTTP. Well it is what I call (there may be a
formal name) the technique where you flag the content with the
Transfer-Encoding: gzip header and zip the contentent.  This gives a huge
boost to bandwith usage to most users except modems which use hardware
compression (unless the stream is encrypted https which basically disables
the hardware compression).

BTW, the performance impact is minimal as the zip code in java is written in
c.

-dain

- Original Message -
From: Dan - Blue Lotus Software [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 13, 2001 11:43 AM
Subject: [JBoss-dev] RE: [Jobs-dev] what is webOS?


 Sorry.  Zipped files were still excessively large.  You don't want to take
a
 600GB survey and turn it into a 2 TB data set.  That wouldn't fit on
 available disk space.  And data access, consisting of uncompressing XML,
 then parsing it, would be unacceptable for data volumes this big.

 -dan

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of
 Andrius Juozapaitis
 Sent: Monday, August 13, 2001 5:22 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [JBoss-dev] what is webOS?


 hey,

 : The overhead of XML is still too great to handle seismic surveys.  It's
 not
 : uncommon for seismic surveys to be 100+GB.  I've even seen one survey
that
 : was almost 1 TB big!  Yes, it was loaded all on the same machine at one
 : time.  Typical workstations (not servers--desktop workstations) will
have
 : 200+GB of disk space, with some special-purpose workstations having far
 more
 : than that.  I'm not sure it really will ever be feasible to store
seismic
 : data in XML.

 as xml compresses extremely well, having it put to a zip file would help a
 lot IMHO, and then use zip input streams for parsing when needed. on the
 other hand, there are ways to use things like windows disk compression for
 handling such completely transparently, though I'm not familiar with the
 implementation of such mechanisms. the drawback is that you loose some cpu
 power. just my 2ct.

 best regards,
 --andrius


 ___
 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



[JBoss-dev] EJB-QL help

2001-08-17 Thread Dain Sundstrom

For thoes of you that have looked at EJB-QL,

Can you think of a logical query that uses the MEMBER OF opperator? I can't
seem to think of any examples that are not completely contrived.  If you
can,  how would you map it to SQL?  How about the same for the NOT MEMBER OF
opperator?

The EJB-QL code is almost done. Just 4 or 5 dangling strings to tie up.

Thanks,

-dain


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



Re: [JBoss-dev] EJB-QL help

2001-08-17 Thread Dain Sundstrom

I plan on supporting order by.


- Original Message - 
From: Brenton House [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 17, 2001 12:32 PM
Subject: RE: [JBoss-dev] EJB-QL help


 Do you know if JBoss EJB-QL is going to support order by ?
 I know it is not part of the spec but several vendors are
 supporting it after sun dropped the ball...
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]] On Behalf Of Dain
 Sundstrom
 Sent: Friday, August 17, 2001 12:26 PM
 To: [EMAIL PROTECTED]
 Subject: [JBoss-dev] EJB-QL help
 
 
 For thoes of you that have looked at EJB-QL,
 
 Can you think of a logical query that uses the MEMBER OF opperator? I
 can't seem to think of any examples that are not completely contrived.
 If you can,  how would you map it to SQL?  How about the same for the
 NOT MEMBER OF opperator?
 
 The EJB-QL code is almost done. Just 4 or 5 dangling strings to tie up.
 
 Thanks,
 
 -dain
 
 
 ___
 Jboss-development mailing list [EMAIL PROTECTED]
 http://lists.sourceforge.net/lists/listinfo/jboss-development
 
 
 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 
 
 ___
 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-dev] JDBC SQL Extensions

2001-08-17 Thread Dain Sundstrom

all JDBC experts,

Is it common for the JDBC drivers to support the SQL Extension functions?
http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame11.html

I specifically need the functions: concat, substring, locate, length, abs,
and sqrt.

I'm planing on mapping these to {fn concat('str1', 'str2')} style functions.
If it is not common to support these fuctions I'll write a function map spec
in the xml.

Also, do most vendors support the {oj outer-join} syntax like:

SELECT *
FROM {oj order LEFT OUTER JOIN line_item ON
order.ordernumber=line_item.ordernumber}

I think I need this to support the IS EMPTY operator in queries like:

SELECT OBJECT(o)
FROM Order o
WHERE o.lineItems IS  EMPTY


Thanks for any help

-dain

P.S. I just found some docs that say that Oracle drivers do not support any
of these portability features (my words). Does anyone find this
supprising? (I'll keep my feelings on this to my self).  Any way, if it is
true, I'll implement this the hard way after I get the easy way working.


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



Re: [JBoss-dev] JDBC SQL Extensions

2001-08-17 Thread Dain Sundstrom

consice does not equal understandable

for example

a?b:c

-dain
- Original Message -
From: Jay Walters [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 17, 2001 2:16 PM
Subject: RE: [JBoss-dev] JDBC SQL Extensions


 Not to be too much in oracle's defense, but their proprietary outer join
 syntax is much more concise.  I think you will need to do mapping onto the
 various vendor's syntax...

 -Original Message-
 From: Dain Sundstrom [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 17, 2001 3:11 PM
 To: [EMAIL PROTECTED]
 Subject: [JBoss-dev] JDBC SQL Extensions


 all JDBC experts,

 Is it common for the JDBC drivers to support the SQL Extension functions?
 http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec/jdbc-spec.frame11.html

 I specifically need the functions: concat, substring, locate, length, abs,
 and sqrt.

 I'm planing on mapping these to {fn concat('str1', 'str2')} style
functions.
 If it is not common to support these fuctions I'll write a function map
spec
 in the xml.

 Also, do most vendors support the {oj outer-join} syntax like:

 SELECT *
 FROM {oj order LEFT OUTER JOIN line_item ON
 order.ordernumber=line_item.ordernumber}

 I think I need this to support the IS EMPTY operator in queries like:

 SELECT OBJECT(o)
 FROM Order o
 WHERE o.lineItems IS  EMPTY


 Thanks for any help

 -dain

 P.S. I just found some docs that say that Oracle drivers do not support
any
 of these portability features (my words). Does anyone find this
 supprising? (I'll keep my feelings on this to my self).  Any way, if it is
 true, I'll implement this the hard way after I get the easy way working.


 ___
 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



Re: [JBoss-dev] JDBC SQL Extensions

2001-08-17 Thread Dain Sundstrom

Sorry for the confusion. There are two issues here.

==

Issue1: use of the {fn concat(str1, str2)} style functions.

Solution: use fn style functions as default but have override in xml like:
concat-functionCONCAT (?1, ?2)/concat-function
or some thing simmilar.

==

Issue 2: IS EMPTY function. How should I map the following ejb-ql query:

SELECT OBJECT(o)
FROM Order o
WHERE o.lineItems IS  EMPTY

Solution A:

SELECT o.ordernumber
FROM Order o
WHERE NOT EXISTS (
SELECT l.pk
FROM Order o, LineItem l
WHERE o.ordernumber = l.ordernumber)

I like this because it does not use an outer join (thanks Dave Smith). Does
it have performance problems?

Solution B:

SELECT o.ordernumber
FROM Order o LEFT OUTER JOIN LineItem l ON o.ordernumber = l.ordernumber
WHERE l.ordernumber IS NULL

This would be a major pain to map to all vendors.




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



Re: [JBoss-dev] JDBC SQL Extensions

2001-08-17 Thread Dain Sundstrom

David,

What a cool idea. I was just thinking (in the shower) about this a solution
like this, but using a JDBC wrapper.  I still plan on going ahead with my
solution, but in the future I think it would be a smart idea to move it back
into the ra. (Unless someone wants to write the ra wrapper).

-dain


- Original Message -
From: David Jencks [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 17, 2001 4:46 PM
Subject: Re: [JBoss-dev] JDBC SQL Extensions


 On 2001.08.17 16:31:43 -0400 Dain Sundstrom wrote:
  Sorry for the confusion. There are two issues here.
 
  ==
 
  Issue1: use of the {fn concat(str1, str2)} style functions.
 
  Solution: use fn style functions as default but have override in xml
  like:
  concat-functionCONCAT (?1, ?2)/concat-function
  or some thing simmilar.

 Conceivable alternate solution:

 Since we are now using resource adapters to wrap the db connections, we
 could write resource adapters for each non-compliant db that suitably
 rewrites these functions to something the db will accept.  Puts the pain
 where it belongs.

 Having a db - specific wrapper-rar might make ManagedConnectionFactory
 configuration a lot simpler too.
 
  ==
 
  Issue 2: IS EMPTY function. How should I map the following ejb-ql query:
 
  SELECT OBJECT(o)
  FROM Order o
  WHERE o.lineItems IS  EMPTY
 
  Solution A:
 
  SELECT o.ordernumber
  FROM Order o
  WHERE NOT EXISTS (
  SELECT l.pk
  FROM Order o, LineItem l
  WHERE o.ordernumber = l.ordernumber)
 
  I like this because it does not use an outer join (thanks Dave Smith).
  Does
  it have performance problems?
 
  Solution B:
 
  SELECT o.ordernumber
  FROM Order o LEFT OUTER JOIN LineItem l ON o.ordernumber = l.ordernumber
  WHERE l.ordernumber IS NULL
 
  This would be a major pain to map to all vendors.
 

 I think which works better is going to depend on what kind of mistakes are
 in the particular db's optimizer.  Naively I would expect (A) to be easier
 to make fast, but I haven't done comparisons.  Go for (A) and see if
anyone
 complains and what db.

 david jencks
 


 
 
  ___
  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



Re: Re[2]: [JBoss-dev] JDBC SQL Extensions

2001-08-18 Thread Dain Sundstrom

Do any other popular databases not support exists?  Any way, I guess MySQL
users get to wait a little while, because I already coded it.

-dain

- Original Message -
From: Oleg Nitz [EMAIL PROTECTED]
To: Dain Sundstrom [EMAIL PROTECTED]
Sent: Saturday, August 18, 2001 5:14 AM
Subject: Re[2]: [JBoss-dev] JDBC SQL Extensions


 Hi Dain,

 Be aware that MySQL doesn't support nested queries.
 Outer joins is more portable solution IMHO.
 BTW in Castor JDO we have database drivers, which map OUTER JOINs
 and FOR UPDATE to all popular databases.

 Oleg

 Dain Sundstrom wrote:
  Issue 2: IS EMPTY function. How should I map the following ejb-ql query:

  SELECT OBJECT(o)
  FROM Order o
  WHERE o.lineItems IS  EMPTY

  Solution A:

  SELECT o.ordernumber
  FROM Order o
  WHERE NOT EXISTS (
  SELECT l.pk
  FROM Order o, LineItem l
  WHERE o.ordernumber = l.ordernumber)

  I like this because it does not use an outer join (thanks Dave Smith).
Does
  it have performance problems?

  Solution B:

  SELECT o.ordernumber
  FROM Order o LEFT OUTER JOIN LineItem l ON o.ordernumber = l.ordernumber
  WHERE l.ordernumber IS NULL

  This would be a major pain to map to all vendors.




  ___
  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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql Assembly.java InputParameterToken.java Literal.java NumberState.java Parser.java StringLiteral.java Symbol.java Terminal.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 08:56:43

  Modified:src/main/org/jboss/ejb/plugins/cmp/ejbql Assembly.java
InputParameterToken.java Literal.java
NumberState.java Parser.java StringLiteral.java
Symbol.java Terminal.java
  Log:
  fixed many small anoying bugs while implementing the ejbql to sql translation engine
  
  Revision  ChangesPath
  1.2   +14 -5 jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/Assembly.java
  
  Index: Assembly.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/Assembly.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Assembly.java 2001/08/09 05:20:49 1.1
  +++ Assembly.java 2001/08/18 15:56:43 1.2
  @@ -4,11 +4,12 @@
   import java.util.ArrayList;
   import java.util.List;
   
  -public class Assembly implements DeepCloneable {
  +public class Assembly {
private DeepCloneable target;
private List stack = new ArrayList();
private List tokens = new ArrayList();
private int tokenIndex;
  + private boolean valid = true;
   
public Assembly(Assembly a) {
if(a.target != null) {
  @@ -17,6 +18,7 @@
stack = new ArrayList(a.stack);
tokens = new ArrayList(a.tokens);
tokenIndex = a.tokenIndex;
  + valid = a.valid;
}

public Assembly(String string) {
  @@ -34,7 +36,18 @@
tokenIndex = 0;
}

  + public boolean isValid() {
  + return valid;
  + }
  + 
  + public void setInvalid() {
  + valid = false;
  + }
  + 
public void push(Object object) {
  + if(object == null) {
  + throw new IllegalArgumentException(object is null);
  + }
stack.add(object);
}
   
  @@ -89,9 +102,5 @@
buf.append(^);
}
return buf.toString();
  - }
  - 
  - public Object deepClone() {
  - return new Assembly(this);
}
   }
  
  
  
  1.2   +4 -0  
jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/InputParameterToken.java
  
  Index: InputParameterToken.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/InputParameterToken.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InputParameterToken.java  2001/08/09 05:20:49 1.1
  +++ InputParameterToken.java  2001/08/18 15:56:43 1.2
  @@ -7,6 +7,10 @@
this.num = num;
}

  + public int getNumber() {
  + return num;
  + }
  + 
public int hashCode() {
return 37 * 17 + num;
}
  
  
  
  1.2   +4 -0  jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/Literal.java
  
  Index: Literal.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/Literal.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Literal.java  2001/08/09 05:20:49 1.1
  +++ Literal.java  2001/08/18 15:56:43 1.2
  @@ -16,4 +16,8 @@
}
return false;
}
  + 
  + public String toString() {
  + return [Literal: literal=+literal+];
  + }
   }
  
  
  
  1.5   +0 -5  jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/NumberState.java
  
  Index: NumberState.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/NumberState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NumberState.java  2001/08/09 21:51:14 1.4
  +++ NumberState.java  2001/08/18 15:56:43 1.5
  @@ -49,7 +49,6 @@
readSuffix(in, out);

String number = out.toString().toLowerCase();
  - System.out.println(number is [+number+]);
if(isExactNumeric(number)) {
return createExactNumericToken(number);
} else {
  @@ -65,7 +64,6 @@
   
// is it a hex number
int second = peekChar(in);  
  - System.out.println(HEX?  + (char)first + (char)second);
if(first == '0'  (second == 'x' || second == 'X')) {
// read the x off the stream and write it out
out.write(in.read());
  @@ -89,8 +87,6 @@

// get all the decimal digits

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc SQLUtil.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 08:58:57

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc SQLUtil.java
  Log:
  Added helper methods for bean to bean compare and bean to parameter compare.
  
  Revision  ChangesPath
  1.3   +70 -1 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java
  
  Index: SQLUtil.java
  ===
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/SQLUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SQLUtil.java  2001/08/03 17:15:46 1.2
  +++ SQLUtil.java  2001/08/18 15:58:57 1.3
  @@ -13,7 +13,7 @@
* SQLUtil helps with building sql statements.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
*/
   public class SQLUtil {
// ===
  @@ -263,4 +263,73 @@
return buf.toString();
}   
   
  + /**
  + * Returns parent.pkColumnName0=child.fkColumnName0 [AND 
parent.pkColumnName1=child.fkColumnName1 [AND parent.pkColumnName2=child.fkColumnName2 
[...]]] 
  + */
  + public static String getWhereClause(JDBCCMPFieldBridge pkField, String parent, 
JDBCCMPFieldBridge fkField, String child) {
  + return getWhereClause(pkField.getJDBCType(), parent, 
fkField.getJDBCType(), child);
  + }
  +
  + /**
  + * Returns parent.pkColumnName0=child.fkColumnName0 [AND 
parent.pkColumnName1=child.fkColumnName1 [AND parent.pkColumnName2=child.fkColumnName2 
[...]]] 
  + */
  + public static String getWhereClause(JDBCType pkType, String parent, JDBCType 
fkType, String child) {
  + if(parent.length()  0) {
  + parent += .;
  + }
  + if(child.length()  0) {
  + child += .;
  + }
  +
  + String[] pkColumnNames = pkType.getColumnNames();
  + String[] fkColumnNames = fkType.getColumnNames();
  + if(pkColumnNames.length != fkColumnNames.length) {
  + throw new IllegalArgumentException(PK and FK have different 
number of columns);
  + }
  +
  + StringBuffer buf = new StringBuffer();
  + for(int i=0; ipkColumnNames.length; i++) {
  + if(i!=0) {
  + buf.append( AND );
  + }
  + buf.append(parent).append(pkColumnNames[i]);
  + buf.append(=);
  + buf.append(child).append(fkColumnNames[i]);
  + }
  + return buf.toString();
  + }   
  +
  + public static String getSelfCompareWhereClause(JDBCCMPFieldBridge[] fields, 
String fromIdentifier, String toIdentifier) {
  + 
  + StringBuffer buf = new StringBuffer();
  + for(int i=0; ifields.length; i++) {
  + if(i!=0) {
  + buf.append( AND );
  + }
  + buf.append(getSelfCompareWhereClause(fields[i].getJDBCType(), 
fromIdentifier, toIdentifier));
  + }
  + return buf.toString();
  + }   
  + 
  + public static String getSelfCompareWhereClause(JDBCType type, String 
fromIdentifier, String toIdentifier) {
  + if(fromIdentifier.length()  0) {
  + fromIdentifier += .;
  + }
  + if(toIdentifier.length()  0) {
  + toIdentifier += .;
  + }
  + 
  + String[] columnNames = type.getColumnNames();
  +
  + StringBuffer buf = new StringBuffer();
  + for(int i=0; icolumnNames.length; i++) {
  + if(i!=0) {
  + buf.append( AND );
  + }
  + buf.append(fromIdentifier).append(columnNames[i]);
  + buf.append( = );
  + buf.append(toIdentifier).append(columnNames[i]);
  + }
  + return buf.toString();
  + }   
   }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCApplicationMetaData.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:08:47

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCApplicationMetaData.java
  Log:
  Added getBeanByAbstractSchemaName method
  
  Revision  ChangesPath
  1.8   +20 -2 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCApplicationMetaData.java
  
  Index: JDBCApplicationMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCApplicationMetaData.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDBCApplicationMetaData.java  2001/08/03 17:15:47 1.7
  +++ JDBCApplicationMetaData.java  2001/08/18 16:08:47 1.8
  @@ -30,7 +30,7 @@
*  
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
*   @author a href=[EMAIL PROTECTED]Sebastien Alborini/a
  - *   @version $Revision: 1.7 $
  + *   @version $Revision: 1.8 $
*/
   public final class JDBCApplicationMetaData {
public final static String JDBC_PM = 
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager;
  @@ -73,6 +73,11 @@
private final Map valueClasses = new HashMap();

/**
  +  * Map from abstract schema name to entity name 
  +  */
  + private final Map entitiesByAbstractSchemaName = new HashMap();
  +  
  + /**
 * Constructs jdbc application meta data with the data from the 
applicationMetaData.
 *
 * @param applicationMetaData the application data loaded from the ejb-jar.xml 
file
  @@ -99,7 +104,7 @@
if(entity.isCMP()  
entity.getContainerConfiguration().getPersistenceManager().equals(JDBC_PM)) {
JDBCEntityMetaData jdbcEntity = new 
JDBCEntityMetaData(this, entity);
entities.put(entity.getEjbName(), jdbcEntity);
  -
  + 
entitiesByAbstractSchemaName.put(jdbcEntity.getAbstractSchemaName(), jdbcEntity);
entityRoles.put(entity.getEjbName(), new 
HashMap());
}
}
  @@ -153,13 +158,16 @@
   
// get default settings for the beans (optional, but always set in 
standardjbosscmp-jdbc.xml)
entities.putAll(defaultValues.entities);
  + 
entitiesByAbstractSchemaName.putAll(defaultValues.entitiesByAbstractSchemaName);
Element defaults = MetaData.getOptionalChild(element, defaults);
if(defaults != null) {
ArrayList values = new ArrayList(entities.values());
for(Iterator i = values.iterator(); i.hasNext(); ) {
JDBCEntityMetaData entityMetaData = 
(JDBCEntityMetaData)i.next();
entityMetaData = new JDBCEntityMetaData(this, 
defaults, entityMetaData);
  + // replace the old meta data with the new
entities.put(entityMetaData.getName(), entityMetaData);
  + 
entitiesByAbstractSchemaName.put(entityMetaData.getAbstractSchemaName(), 
entityMetaData);
}
}   

  @@ -176,6 +184,7 @@
if(entityMetaData != null) {
entityMetaData = new JDBCEntityMetaData(this, 
beanElement, entityMetaData);
entities.put(entityMetaData.getName(), 
entityMetaData);
  + 
entitiesByAbstractSchemaName.put(entityMetaData.getAbstractSchemaName(), 
entityMetaData);
} else {
Logger.warning(Warning: data found in 
jbosscmp-jdbc.xml for entity  + ejbName +  but bean is not a jbosscmp-jdbc-managed 
cmp entity in ejb-jar.xml); 
}
  @@ -292,5 +301,14 @@
 */
public JDBCEntityMetaData getBeanByEjbName(String name) { 
return (JDBCEntityMetaData)entities.get(name);
  + }
  + 
  + /**
  +  * Gets the metadata for an entity bean by the abstract schema name.
  +  * @param name the abstract schema name of the entity meta data to return
  +  * @return the entity meta data for the specified name
  +  */
  + public JDBCEntityMetaData getBeanByAbstractSchemaName(String name) { 
  + return (JDBCEntityMetaData)entitiesByAbstractSchemaName.get(name);
}
   }
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCEntityBridge.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:03:36

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge
JDBCEntityBridge.java
  Log:
  Added get cmr field by name method.
  
  Revision  ChangesPath
  1.6   +10 -2 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCEntityBridge.java
  
  Index: JDBCEntityBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCEntityBridge.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JDBCEntityBridge.java 2001/08/03 17:15:47 1.5
  +++ JDBCEntityBridge.java 2001/08/18 16:03:35 1.6
  @@ -51,7 +51,7 @@
*   One per cmp entity bean type.   
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
*/
   public class JDBCEntityBridge implements EntityBridge {
  protected JDBCEntityMetaData metadata;
  @@ -62,6 +62,8 @@
protected JDBCCMPFieldBridge[] primaryKeyFields;
   
protected JDBCCMRFieldBridge[] cmrFields;
  + protected Map cmrFieldsByName;
  + 
protected JDBCSelectorBridge[] selectors;

protected JDBCCMPFieldBridge[] eagerLoadFields;
  @@ -154,7 +156,8 @@
}

protected void loadCMRFields(JDBCEntityMetaData metadata) throws 
DeploymentException {
  - ArrayList cmrFieldList = new ArrayList(metadata.getCMPFields().size());
  + cmrFieldsByName = new HashMap(metadata.getRelationshipRoles().size());
  + ArrayList cmrFieldList = new 
ArrayList(metadata.getRelationshipRoles().size());
   
 // create each field
Iterator iter = metadata.getRelationshipRoles().iterator();
  @@ -162,6 +165,7 @@
JDBCRelationshipRoleMetaData relationshipRole = 
(JDBCRelationshipRoleMetaData)iter.next();
JDBCCMRFieldBridge cmrField = new JDBCCMRFieldBridge(this, 
manager, relationshipRole); 
cmrFieldList.add(cmrField);
  + cmrFieldsByName.put(cmrField.getFieldName(), cmrField);
}

// save the cmr fields in the cmr field array
  @@ -238,6 +242,10 @@

public CMRFieldBridge[] getCMRFields() {
return cmrFields;
  + }
  + 
  + public JDBCCMRFieldBridge getCMRFieldByName(String name) {
  + return (JDBCCMRFieldBridge)cmrFieldsByName.get(name);
}

public JDBCCMRFieldBridge[] getJDBCCMRFields() {
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMRFieldBridge.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:04:26

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge
JDBCCMRFieldBridge.java
  Log:
  Added get entity method.
  
  Revision  ChangesPath
  1.5   +5 -1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMRFieldBridge.java
  
  Index: JDBCCMRFieldBridge.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMRFieldBridge.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCCMRFieldBridge.java   2001/08/03 17:15:47 1.4
  +++ JDBCCMRFieldBridge.java   2001/08/18 16:04:26 1.5
  @@ -44,7 +44,7 @@
*   One for each role that entity has.  
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*/
   public class JDBCCMRFieldBridge implements CMRFieldBridge {
// -- Invocation messages --
  @@ -263,6 +263,10 @@
 */
public JDBCStoreManager getJDBCStoreManager() {
return manager;
  + }
  + 
  + public JDBCEntityBridge getEntity() {
  + return entity;
}

/**
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCEntityMetaData.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:10:28

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCEntityMetaData.java
  Log:
  Added getAbstractSchemaName method
  
  Revision  ChangesPath
  1.5   +17 -2 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCEntityMetaData.java
  
  Index: JDBCEntityMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCEntityMetaData.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCEntityMetaData.java   2001/08/03 17:15:47 1.4
  +++ JDBCEntityMetaData.java   2001/08/18 16:10:28 1.5
  @@ -27,7 +27,7 @@
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
*   @author a href=[EMAIL PROTECTED]Sebastien Alborini/a
* @author a href=mailto:[EMAIL PROTECTED];Dirk Zimmermann/a
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
*/
   public final class JDBCEntityMetaData {
/**
  @@ -56,6 +56,11 @@
private final String entityName;

/**
  +* the abstract schema name of this entity
  +  */
  + private final String abstractSchemaName;
  +
  + /**
 * the implementation class of this entity
 */
private final Class entityClass;
  @@ -157,6 +162,7 @@
public JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, 
EntityMetaData entity) throws DeploymentException {
this.jdbcApplication = jdbcApplication;
entityName = entity.getEjbName();
  + abstractSchemaName = entity.getAbstractSchemaName();

try {
entityClass = getClassLoader().loadClass(entity.getEjbClass());
  @@ -260,7 +266,8 @@
this.jdbcApplication = jdbcApplication;
   
// set default values 
  - entityName = defaultValues.getName(); 
  + entityName = defaultValues.getName();
  + abstractSchemaName = defaultValues.getAbstractSchemaName();
entityClass = defaultValues.getEntityClass();
primaryKeyClass = defaultValues.getPrimaryKeyClass();
isCMP1x = defaultValues.isCMP1x;
  @@ -516,6 +523,14 @@
 */
public String getName() {
return entityName;
  + }
  +
  + /**
  +  * Gets the abstract shcema name of this entity. The name come from the 
ejb-jar.xml file.
  +  * @return the abstract schema name of this entity
  +  */
  + public String getAbstractSchemaName() {
  + return abstractSchemaName;
}
   
/**
  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationshipRoleMetaData.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:13:05

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCRelationshipRoleMetaData.java
  Log:
  Changed algorithm which generates default column names to generate more unique names.
  
  Revision  ChangesPath
  1.5   +25 -7 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationshipRoleMetaData.java
  
  Index: JDBCRelationshipRoleMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCRelationshipRoleMetaData.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCRelationshipRoleMetaData.java 2001/08/03 17:15:47 1.4
  +++ JDBCRelationshipRoleMetaData.java 2001/08/18 16:13:05 1.5
  @@ -22,7 +22,7 @@
* ejb-jar.xml file's ejb-relation elements.
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*/
   public final class JDBCRelationshipRoleMetaData {
/**
  @@ -84,7 +84,7 @@
for(Iterator i = entity.getCMPFields().iterator(); 
i.hasNext(); ) {
JDBCCMPFieldMetaData cmpField = 
(JDBCCMPFieldMetaData)i.next();
if(cmpField.isPrimaryKeyMember()) {
  - cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, entity.getName() + _ + cmpField.getFieldName(), false);
  + cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, getCMRFieldName() + _ + cmpField.getFieldName(), false);
tableKeyFields.put(cmpField.getFieldName(), 
cmpField);
}
}
  @@ -95,7 +95,7 @@
for(Iterator i = relatedEntity.getCMPFields().iterator(); 
i.hasNext(); ) {
JDBCCMPFieldMetaData cmpField = 
(JDBCCMPFieldMetaData)i.next();
if(cmpField.isPrimaryKeyMember()) {
  - cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, relatedEntity.getName() + _ + cmpField.getFieldName(), false);
  + cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, getCMRFieldName() + _ + cmpField.getFieldName(), false);
foreignKeyFields.put(cmpField.getFieldName(), 
cmpField);
}
}
  @@ -123,7 +123,7 @@
for(Iterator i = entity.getCMPFields().iterator(); 
i.hasNext(); ) {
JDBCCMPFieldMetaData cmpField = 
(JDBCCMPFieldMetaData)i.next();
if(cmpField.isPrimaryKeyMember()) {
  - cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, entity.getName() + _ + cmpField.getFieldName(), false);
  + cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, getCMRFieldName() + cmpField.getFieldName(), false);
tableKeyFields.put(cmpField.getFieldName(), 
cmpField);
}
}
  @@ -134,7 +134,7 @@
for(Iterator i = relatedEntity.getCMPFields().iterator(); 
i.hasNext(); ) {
JDBCCMPFieldMetaData cmpField = 
(JDBCCMPFieldMetaData)i.next();
if(cmpField.isPrimaryKeyMember()) {
  - cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, relatedEntity.getName() + _ + cmpField.getFieldName(), false);
  + cmpField = new JDBCCMPFieldMetaData(entity, 
cmpField, getCMRFieldName() + _ + cmpField.getFieldName(), false);
foreignKeyFields.put(cmpField.getFieldName(), 
cmpField);
}
}
  @@ -194,6 +194,24 @@
}

/**
  +  * Is this field single valued, that means it does not return a collection.
  +  * A relationship role is single valued if the related role has a multiplicity 
of one.
  +  * @return true if this role does not return a collection 
  +  */
  + public boolean isSingleValued() {
  + return getRelatedRole().isMultiplicityOne();
  + }
  + 
  + /**
  +  * Is this field collection valued, that means it returns a collection.
  +  * A relationship role is collection valued if the related role has a 
multiplicity of many.
  +  * @return true if this role returns a collection 
  +  */
  + public boolean isCollectionValued() {
  + return getRelatedRole().isMultiplicityMany();
  + }
  +
  + /**
 * Should this entity be deleted when related

[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCEJBQLFinderCommand.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 09:16:52

  Added:   src/main/org/jboss/ejb/plugins/cmp/jdbc
JDBCEJBQLFinderCommand.java
  Log:
  This command handles EJB-QL queries.
  
  Revision  ChangesPath
  1.1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCEJBQLFinderCommand.java
  
  Index: JDBCEJBQLFinderCommand.java
  ===
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.ejb.plugins.cmp.jdbc;
  
  import java.sql.PreparedStatement;
  import java.util.ArrayList;
  import java.util.List;
  import org.jboss.deployment.DeploymentException;
  import org.jboss.ejb.plugins.cmp.ejbql.Assembly;
  import org.jboss.ejb.plugins.cmp.ejbql.Parser;
  import org.jboss.ejb.plugins.cmp.jdbc.ejbql.EJBQLParser;
  import org.jboss.ejb.plugins.cmp.jdbc.ejbql.SQLTarget;
  import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData;
  import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQlQueryMetaData;
  
  /**
   * JDBCDefinedFinderCommand finds entities based on an xml sql specification.
   * This class needs more work and I will clean it up in CMP 2.x phase 3.
   * The only thing to to note is the seperation of query into a from and where
   * clause. This code has been cleaned up to improve readability.
   *
   * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
   * @version $Revision: 1.1 $
   */
  public class JDBCEJBQLFinderCommand extends JDBCFinderCommand
  {
 // Attributes 
 
 private int[] parameterArray;
  
 // Constructors --
  
 public JDBCEJBQLFinderCommand(JDBCStoreManager manager, JDBCQueryMetaData q) 
throws DeploymentException {
super(manager, q);
  
JDBCQlQueryMetaData metadata = (JDBCQlQueryMetaData)q;
log.debug(EQL-QL: +metadata.getEjbQl());
Parser ejbql = new EJBQLParser().ejbqlQuery();
Assembly a = new Assembly(metadata.getEjbQl());
a.setTarget(new SQLTarget(manager.getContainer().getApplication()));
a = ejbql.soleMatch(a);
log.debug(Assembly: +a);
SQLTarget target = (SQLTarget)a.getTarget();
setSQL(target.toSQL());

List l  = target.getInputParameters();
parameterArray = new int[l.size()];
for(int i=0; il.size(); i++) {
// convert to 0 based parameter index
parameterArray[i] = ((Integer)l.get(i)).intValue()-1;
}
}
   
 // JDBCFinderCommand overrides 
  
protected void setParameters(PreparedStatement ps, Object argOrArgs) throws 
Exception {
Object[] args = (Object[])argOrArgs;

for(int i = 0; i  parameterArray.length; i++) {
Object arg = args[parameterArray[i]];
int jdbcType = 
manager.getJDBCTypeFactory().getJDBCTypeForJavaType(arg.getClass());
JDBCUtil.setParameter(log, ps, i+1, jdbcType, arg);
}
}   
  }
  
  
  

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



[JBoss-dev] EJB-QL initial revision done

2001-08-18 Thread Dain Sundstrom

I just committed the initial revision of the EJB-QL to SQL translation
engine.  All you need to do to use the engine is get the new code and add
you EJB-QL query to the ejb-jar.xml file. There are some several
restrictions:

1) This only works for finders. ejbSelect methods are not implemented yet.

2) There is ZERO error handling. If you query is bad, you will get a generic
exception.

3) Functions are mapped to {fn concat(str1, str2)} style functions. If you
are using Oracle, functions will not work for you.

4) The IS EMPTY operator is mapped to an EXISTS operator. If you are using
MySQL or mSQL, you can't use the IS EMPTY clause.

5) The algorithm that generates aliases for the tables is barely functional.
It can easily generate you an aliases that is a reserved word or already
used.

6) The code sucks.  About half way through writing this section, I decided
that I had no idea what the final code would look like, so I gave up on
logically organizing the code. The engine needs a couple of rewrites.

7) Most exceptions are caused by a bad EJB-QL query. If you get an
exception, check the query, and if you still think it is OK, check the
EJB-QL BNF. EJB-QL syntax is very restrictive for example:
p.name = 'Name'is legal
'Name' = p.nameis not legal
'Name' =  'Name'   is not legal
If you are still sure it is broken, send me the query.

Enough said.  Have fun.

-dain


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



Re: [JBoss-dev] JDBC SQL Extensions

2001-08-18 Thread Dain Sundstrom

I did a little investigation and found that mSQL does not support EXISTS or
JOIN so mSQL users will never be able to use the IS EMPTY operator.

-dain

- Original Message -
From: Oleg Nitz [EMAIL PROTECTED]
To: Dain Sundstrom [EMAIL PROTECTED]
Sent: Saturday, August 18, 2001 10:34 AM
Subject: Re: [JBoss-dev] JDBC SQL Extensions


 Dain Sundstrom wrote:
  Do any other popular databases not support exists?
 No, only MySQL and mSQL don't support, all other databases support
 nested queries.

 Oleg



 ___
 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-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql EJBQLParser.java SQLTarget.java

2001-08-18 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/18 20:32:24

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql
EJBQLParser.java SQLTarget.java
  Log:
  Changed ejb-ql command to set select distinct when an Set is to be returned.
  
  Revision  ChangesPath
  1.2   +8 -5  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/EJBQLParser.java
  
  Index: EJBQLParser.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/EJBQLParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EJBQLParser.java  2001/08/18 15:53:20 1.1
  +++ EJBQLParser.java  2001/08/19 03:32:24 1.2
  @@ -203,22 +203,25 @@

if(element.equalsIgnoreCase(SELECT)) 
{
Collections.reverse(path);
  - target.setSelectPath(path, 
false);
  + target.setSelectPath(path);
return;
}

if(element.equalsIgnoreCase(DISTINCT)) {
a.pop(); // pop the word 
'SELECT'
  + target.setSelectDistinct(true);
Collections.reverse(path);
  - target.setSelectPath(path, 
true);
  + target.setSelectPath(path);
return;
}
if(element.equalsIgnoreCase(OBJECT)) 
{
  - boolean isDistinct = 
DISTINCT.equalsIgnoreCase(a.pop().toString());
  - if(isDistinct) {
  + // pop the next word (will be 
distinct or select)
  + String word = 
a.pop().toString();
  + 
if(DISTINCT.equalsIgnoreCase(word)) {
  + 
target.setSelectDistinct(true);
a.pop(); // pop the 
word 'SELECT'
}
Collections.reverse(path);
  - target.setSelectPath(path, 
isDistinct);
  + target.setSelectPath(path);
return;
}
path.add(element);
  
  
  
  1.2   +4 -1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLTarget.java
  
  Index: SQLTarget.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLTarget.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SQLTarget.java2001/08/18 15:53:20 1.1
  +++ SQLTarget.java2001/08/19 03:32:24 1.2
  @@ -69,8 +69,11 @@
whereClause = target.whereClause;
}
   
  - public void setSelectPath(List selectPath, boolean isSelectDistinct) {
  + public void setSelectDistinct(boolean isSelectDistinct) {
this.isSelectDistinct = isSelectDistinct;
  + }
  +
  + public void setSelectPath(List selectPath) {
this.selectPath = selectPath;
}

  
  
  

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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCTypeMappingMetaData.java

2001-08-19 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/19 15:50:33

  Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCTypeMappingMetaData.java
  Log:
  Added function mapping for EJB-QL.
  
  Revision  ChangesPath
  1.4   +81 -2 
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCTypeMappingMetaData.java
  
  Index: JDBCTypeMappingMetaData.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCTypeMappingMetaData.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JDBCTypeMappingMetaData.java  2001/08/03 17:15:47 1.3
  +++ JDBCTypeMappingMetaData.java  2001/08/19 22:50:33 1.4
  @@ -18,7 +18,7 @@
*
* @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a
*   @author a href=[EMAIL PROTECTED]Sebastien Alborini/a
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
*/
   public final class JDBCTypeMappingMetaData {

  @@ -29,6 +29,8 @@
private final String name;

private final HashMap mappings = new HashMap();
  + 
  + private final HashMap functionMappings = new HashMap();
   
/**
 * Constructs a mapping with the data contained in the type-mapping xml element
  @@ -46,11 +48,21 @@
// get the mappings
Iterator iterator = MetaData.getChildrenByTagName(element, mapping);

  - while (iterator.hasNext()) {
  + while(iterator.hasNext()) {
Element mappingElement = (Element)iterator.next();
JDBCMappingMetaData mapping = new 
JDBCMappingMetaData(mappingElement);
mappings.put(mapping.getJavaType(), mapping);
}
  +
  + addDefaultFunctionMapping();
  + 
  + // get the mappings
  + Iterator functions = MetaData.getChildrenByTagName(element, 
function-mapping);
  + while(functions.hasNext()) {
  + Element mappingElement = (Element)functions.next();
  + JDBCFunctionMappingMetaData functionMapping = new 
JDBCFunctionMappingMetaData(mappingElement);
  + 
functionMappings.put(functionMapping.getFunctionName().toLowerCase(), functionMapping);
  + }
}

/**
  @@ -122,5 +134,72 @@
}

return mapping.getSqlType();
  + }
  + 
  + public JDBCFunctionMappingMetaData getFunctionMapping(String name) {
  + return 
(JDBCFunctionMappingMetaData)functionMappings.get(name.toLowerCase());
  + }
  + 
  + private void addDefaultFunctionMapping() {
  + JDBCFunctionMappingMetaData function;
  + 
  + // concat
  + function = new JDBCFunctionMappingMetaData(concat,
  + new String[] { 
  + {fn concat(,
  +, ,
  + )}  
  + },
  + new int[] {0, 1} );
  + functionMappings.put(function.getFunctionName().toLowerCase(), 
function);   
  +
  + // substring
  + function = new JDBCFunctionMappingMetaData(substring,
  + new String[] {
  + {fn substring(,
  + , ,
  + , ,
  + )}
  + },
  + new int[] {0, 1, 2} );
  + functionMappings.put(function.getFunctionName().toLowerCase(), 
function);   
  +
  + // length
  + function = new JDBCFunctionMappingMetaData(length,
  + new String[] {
  + {fn length(,
  + )}
  + },
  + new int[] {0} );
  + functionMappings.put(function.getFunctionName().toLowerCase(), 
function);   
  +
  + // locate
  + function = new JDBCFunctionMappingMetaData(locate,
  + new String[] {
  + {fn locate(,
  + , ,
  + , ,
  + )}
  + },
  + new int[] {0, 1

[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjbosscmp-jdbc.xml

2001-08-19 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/19 15:52:16

  Modified:src/etc/conf/default standardjbosscmp-jdbc.xml
  Log:
  Added function mappings for MS SQLServer, Oracle, MySql and PostgreSQL.
  
  Revision  ChangesPath
  1.4   +151 -1jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml
  
  Index: standardjbosscmp-jdbc.xml
  ===
  RCS file: /cvsroot/jboss/jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- standardjbosscmp-jdbc.xml 2001/08/06 22:52:22 1.3
  +++ standardjbosscmp-jdbc.xml 2001/08/19 22:52:15 1.4
  @@ -6,7 +6,7 @@
   !--   --
   !-- = --
   
  -!-- $Id: standardjbosscmp-jdbc.xml,v 1.3 2001/08/06 22:52:22 user57 Exp $ --
  +!-- $Id: standardjbosscmp-jdbc.xml,v 1.4 2001/08/19 22:52:15 dsundstrom Exp $ --
   
   jbosscmp-jdbc
  
  @@ -167,6 +167,32 @@
   
 type-mapping
 nameOracle8/name
  +
  +  function-mapping
  + function-nameconcat/function-name
  + function-sql(?1 || ?2)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesubstring/function-name
  + function-sqlsubstr(?1, ?2, ?3)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelength/function-name
  + function-sqllen(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelocate/function-name
  + function-sqlinstr(?1, ?2, ?3)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-nameabs/function-name
  + function-sqlabs(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesqrt/function-name
  + function-sqlsqrt(?1)/function-sql
  +  /function-mapping 
  +
 mapping
java-typejava.lang.Boolean/java-type
jdbc-typeBIT/jdbc-type
  @@ -243,6 +269,32 @@
   
 type-mapping
 nameOracle7/name
  +
  +  function-mapping
  + function-nameconcat/function-name
  + function-sql(?1 || ?2)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesubstring/function-name
  + function-sqlsubstr(?1, ?2, ?3)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelength/function-name
  + function-sqllen(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelocate/function-name
  + function-sqlinstr(?1, ?2, ?3)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-nameabs/function-name
  + function-sqlabs(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesqrt/function-name
  + function-sqlsqrt(?1)/function-sql
  +  /function-mapping 
  +
 mapping
java-typejava.lang.Boolean/java-type
jdbc-typeBIT/jdbc-type
  @@ -386,6 +438,27 @@
   
 type-mapping
 namePostgreSQL/name
  +  function-mapping
  + function-nameconcat/function-name
  + function-sql(?1 || ?2)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesubstring/function-name
  + function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelength/function-name
  + function-sqllength(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-nameabs/function-name
  + function-sqlabs(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesqrt/function-name
  + function-sqlsqrt(?1)/function-sql
  +  /function-mapping 
  +  
 mapping
java-typejava.lang.Boolean/java-type
jdbc-typeTINYINT/jdbc-type
  @@ -519,6 +592,7 @@
   
 type-mapping
 nameHypersonic SQL/name
  +  
 mapping
java-typejava.lang.Byte/java-type
jdbc-typeSMALLINT/jdbc-type
  @@ -701,6 +775,32 @@
   
 type-mapping
 namemySQL/name
  +
  +  function-mapping
  + function-nameconcat/function-name
  + function-sqlconcat(?1, ?2)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namesubstring/function-name
  + function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
  +  /function-mapping 
  +  function-mapping

[JBoss-dev] SQL function mapping

2001-08-19 Thread Dain Sundstrom

I added the function mapping code to the EJB-QL to SQL translation engine. I
added mappings for MS SQLServer, Oracle, MySQL and PostgreSQL to the
standard jboss cmp xmp file.

Notes:
- These mappings are completely based on info from the 'SQL in a Nutshell'
book, so they may not work (I don't use any of these databases).
- PostgreSQL doesn't have a three argument position function, so I didn't
map it.
- Send me any corrections or change it your self.
- If not mapping is provided the system defaults to {fn concat(param1,
param2)} style functions.

The mappings follow this message.

-dain


Oracle:
function-mapping
function-nameconcat/function-name
function-sql(?1 || ?2)/function-sql
/function-mapping
function-mapping
function-namesubstring/function-name
function-sqlsubstr(?1, ?2, ?3)/function-sql
/function-mapping
function-mapping
function-namelength/function-name
function-sqllen(?1)/function-sql
/function-mapping
function-mapping
function-namelocate/function-name
function-sqlinstr(?1, ?2, ?3)/function-sql
/function-mapping
function-mapping
function-nameabs/function-name
function-sqlabs(?1)/function-sql
/function-mapping
function-mapping
function-namesqrt/function-name
function-sqlsqrt(?1)/function-sql
/function-mapping


MS SQLServer:
function-mapping
function-nameconcat/function-name
function-sql(?1 + ?2)/function-sql
/function-mapping
function-mapping
function-namesubstring/function-name
function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
/function-mapping
function-mapping
function-namelength/function-name
function-sqllen(?1)/function-sql
/function-mapping
function-mapping
function-namelocate/function-name
function-sqlcharindex(?1, ?2, ?3)/function-sql
/function-mapping
function-mapping
function-nameabs/function-name
function-sqlabs(?1)/function-sql
/function-mapping
function-mapping
function-namesqrt/function-name
function-sqlsqrt(?1)/function-sql
/function-mapping

MySQL:
function-mapping
function-nameconcat/function-name
function-sqlconcat(?1, ?2)/function-sql
/function-mapping
function-mapping
function-namesubstring/function-name
function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
/function-mapping
function-mapping
function-namelength/function-name
function-sqllength(?1)/function-sql
/function-mapping
function-mapping
function-namelocate/function-name
function-sqllocate(?1, ?2, ?3)/function-sql
/function-mapping
function-mapping
function-nameabs/function-name
function-sqlabs(?1)/function-sql
/function-mapping
function-mapping
function-namesqrt/function-name
function-sqlsqrt(?1)/function-sql
/function-mapping

PostgreSQL:
function-mapping
function-nameconcat/function-name
function-sql(?1 || ?2)/function-sql
/function-mapping
function-mapping
function-namesubstring/function-name
function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
/function-mapping
function-mapping
function-namelength/function-name
function-sqllength(?1)/function-sql
/function-mapping
function-mapping
function-nameabs/function-name
function-sqlabs(?1)/function-sql
/function-mapping
function-mapping
function-namesqrt/function-name
function-sqlsqrt(?1)/function-sql
/function-mapping



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



[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCFunctionMappingMetaData.java

2001-08-19 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/19 20:19:55

  Added:   src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
JDBCFunctionMappingMetaData.java
  Log:
  Handles metadata about sql function mappings.
  
  Revision  ChangesPath
  1.1  
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCFunctionMappingMetaData.java
  
  Index: JDBCFunctionMappingMetaData.java
  ===
  package org.jboss.ejb.plugins.cmp.jdbc.metadata;
  
  import java.io.IOException;
  import java.io.StringReader;
  import java.util.ArrayList;
  import org.jboss.ejb.DeploymentException;
  import org.jboss.metadata.MetaData;
  import org.w3c.dom.Element;
  
  public final class JDBCFunctionMappingMetaData {
private final String functionName;
private final String[] sqlChunks;
private final int[] parameters;
  
public JDBCFunctionMappingMetaData(String functionName, String[] sqlChunks, 
int[] parameters) {
this.functionName = functionName;
this.sqlChunks = sqlChunks;
this.parameters = parameters;
}
  
public JDBCFunctionMappingMetaData(Element element) throws DeploymentException 
{
functionName = MetaData.getUniqueChildContent(element, 
function-name);

String sql = MetaData.getUniqueChildContent(element, function-sql);

ArrayList chunkList = new ArrayList();  
ArrayList parameterList = new ArrayList();  

// add a dummy chunk so we can be assured that the sql started with 
chunk before a number
if(sql.charAt(0) == '?') {
chunkList.add();
}
// break the sql into chunks and parameters
StringBuffer chunk = new StringBuffer();
StringReader reader = new StringReader(sql);
try {
for(int c=reader.read(); c = 0; c=reader.read()) {
if(c != '?') {
chunk.append((char)c);
} else {
chunkList.add(chunk.toString());
chunk = new StringBuffer();

// read the number
StringBuffer number = new StringBuffer();
for(int digit=reader.read(); digit = 0; 
digit=reader.read()) {
if(Character.isDigit((char)digit)) {
number.append((char)digit);
} else {
if(digit = 0) {

chunk.append((char)digit);
}
break;
}
}
if(number.length() == 0) {
throw new DeploymentException(Invalid 
parameter in function-sql: +sql);
}
Integer parameter = null;
try {
parameter = new 
Integer(number.toString());
} catch(NumberFormatException e) {
throw new DeploymentException(Invalid 
parameter number in function-sql: number=+number+ sql=+sql);
}
parameterList.add(parameter);
}
}
} catch(IOException e) {
// will never happen because io is in memory, but required by 
the interface
throw new DeploymentException(Error parsing function-sql:  + 
sql);
}
chunkList.add(chunk.toString());

// save out the chunks
sqlChunks = new String[chunkList.size()];
chunkList.toArray(sqlChunks);

// save out the parameter order
parameters = new int[parameterList.size()];
for(int i=0; iparameters.length; i++) {
parameters[i] = ((Integer)parameterList.get(i)).intValue()-1;
}   
}
  
public String getFunctionName() {
return functionName;
  

Re: [JBoss-dev] Dain you forgot to commit JDBCFunctionMappingMetaData

2001-08-19 Thread Dain Sundstrom



Oops. Just checked it in.

  - Original Message - 
  From: 
  Bill 
  Burke 
  To: Jboss-Development@Lists. 
  Sourceforge. Net 
  Sent: Sunday, August 19, 2001 9:58 
  PM
  Subject: [JBoss-dev] Dain you forgot to 
  commit JDBCFunctionMappingMetaData
  
  Dain you forgot to commit 
  JDBCFunctionMappingMetaData


Re: [JBoss-dev] SQL function mapping

2001-08-20 Thread Dain Sundstrom

Bill,

I think so.

I think all of these issues with datasource specific configuration are all
related.  I think we need to change the type-mapping section of the xml file
to something like datasource-config (best name I can think of), with
subsections for function mapping, type mappings, join style (maybe), and
general information like select-for-update support and syntax.

Any ideas on the layout of this xml?

We also have the option of doing the conversion in the connector layer and
always using the {...} sql extension format.

-dain


- Original Message -
From: Bill Burke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 20, 2001 9:12 AM
Subject: RE: [JBoss-dev] SQL function mapping


 Dain,

 Can we expand this to CMP 1.x and for select-for-update?

 Thanks,

 Bill

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED]]On Behalf Of Dave
  Smith
  Sent: Monday, August 20, 2001 7:49 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [JBoss-dev] SQL function mapping
 
 
 
 
  Dain
   I added the function mapping code to the EJB-QL to SQL
  translation engine. I
   added mappings for MS SQLServer, Oracle, MySQL and PostgreSQL to the
   standard jboss cmp xmp file.
  
   Notes:
   - These mappings are completely based on info from the 'SQL in
  a Nutshell'
   book, so they may not work (I don't use any of these databases).
   - PostgreSQL doesn't have a three argument position function,
  so I didn't
 
  It is simply two functions
 
  position(?2 in substring(?1 from ?3))+?3
 
 
 
   map it.
   - Send me any corrections or change it your self.
   - If not mapping is provided the system defaults to {fn concat(param1,
   param2)} style functions.
  
   The mappings follow this message.
  
   -dain
  
  
   Oracle:
   function-mapping
   function-nameconcat/function-name
   function-sql(?1 || ?2)/function-sql
   /function-mapping
   function-mapping
   function-namesubstring/function-name
   function-sqlsubstr(?1, ?2, ?3)/function-sql
   /function-mapping
   function-mapping
   function-namelength/function-name
   function-sqllen(?1)/function-sql
   /function-mapping
   function-mapping
   function-namelocate/function-name
   function-sqlinstr(?1, ?2, ?3)/function-sql
   /function-mapping
   function-mapping
   function-nameabs/function-name
   function-sqlabs(?1)/function-sql
   /function-mapping
   function-mapping
   function-namesqrt/function-name
   function-sqlsqrt(?1)/function-sql
   /function-mapping
  
  
   MS SQLServer:
   function-mapping
   function-nameconcat/function-name
   function-sql(?1 + ?2)/function-sql
   /function-mapping
   function-mapping
   function-namesubstring/function-name
   function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
   /function-mapping
   function-mapping
   function-namelength/function-name
   function-sqllen(?1)/function-sql
   /function-mapping
   function-mapping
   function-namelocate/function-name
   function-sqlcharindex(?1, ?2, ?3)/function-sql
   /function-mapping
   function-mapping
   function-nameabs/function-name
   function-sqlabs(?1)/function-sql
   /function-mapping
   function-mapping
   function-namesqrt/function-name
   function-sqlsqrt(?1)/function-sql
   /function-mapping
  
   MySQL:
   function-mapping
   function-nameconcat/function-name
   function-sqlconcat(?1, ?2)/function-sql
   /function-mapping
   function-mapping
   function-namesubstring/function-name
   function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
   /function-mapping
   function-mapping
   function-namelength/function-name
   function-sqllength(?1)/function-sql
   /function-mapping
   function-mapping
   function-namelocate/function-name
   function-sqllocate(?1, ?2, ?3)/function-sql
   /function-mapping
   function-mapping
   function-nameabs/function-name
   function-sqlabs(?1)/function-sql
   /function-mapping
   function-mapping
   function-namesqrt/function-name
   function-sqlsqrt(?1)/function-sql
   /function-mapping
  
   PostgreSQL:
   function-mapping
   function-nameconcat/function-name
   function-sql(?1 || ?2)/function-sql
   /function-mapping
   function-mapping
   function-namesubstring/function-name
   function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
   /function-mapping
   function-mapping
   function-namelength/function-name
   function-sqllength(?1)/function-sql
   /function-mapping
   function-mapping
   function-nameabs/function-name
   function-sqlabs(?1)/function-sql
   /function-mapping
   function-mapping
   function-namesqrt/function-name
   function-sqlsqrt(?1)/function-sql
   /function-mapping
  
  
  
   ___
   Jboss-development mailing list
   [EMAIL PROTECTED]
   http://lists.sourceforge.net/lists/listinfo/jboss-development
  
  
 
 
 
  

[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjbosscmp-jdbc.xml

2001-08-20 Thread Dain Sundstrom

  User: dsundstrom
  Date: 01/08/20 10:19:40

  Modified:src/etc/conf/default standardjbosscmp-jdbc.xml
  Log:
  Added locate function mapping for PostgreSQL.
  
  Revision  ChangesPath
  1.5   +5 -1  jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml
  
  Index: standardjbosscmp-jdbc.xml
  ===
  RCS file: /cvsroot/jboss/jboss/src/etc/conf/default/standardjbosscmp-jdbc.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- standardjbosscmp-jdbc.xml 2001/08/19 22:52:15 1.4
  +++ standardjbosscmp-jdbc.xml 2001/08/20 17:19:40 1.5
  @@ -6,7 +6,7 @@
   !--   --
   !-- = --
   
  -!-- $Id: standardjbosscmp-jdbc.xml,v 1.4 2001/08/19 22:52:15 dsundstrom Exp $ --
  +!-- $Id: standardjbosscmp-jdbc.xml,v 1.5 2001/08/20 17:19:40 dsundstrom Exp $ --
   
   jbosscmp-jdbc
  
  @@ -449,6 +449,10 @@
 function-mapping
function-namelength/function-name
function-sqllength(?1)/function-sql
  +  /function-mapping 
  +  function-mapping
  + function-namelocate/function-name
  + function-sql(position(?2 in substring(?1 from ?3))+?3)/function-sql
 /function-mapping 
 function-mapping
function-nameabs/function-name
  
  
  

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



Re: [JBoss-dev] SQL function mapping

2001-08-20 Thread Dain Sundstrom

Thanks, checked it in.

-dain

- Original Message -
From: Dave Smith [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 20, 2001 6:49 AM
Subject: Re: [JBoss-dev] SQL function mapping




 Dain
  I added the function mapping code to the EJB-QL to SQL translation
engine. I
  added mappings for MS SQLServer, Oracle, MySQL and PostgreSQL to the
  standard jboss cmp xmp file.
 
  Notes:
  - These mappings are completely based on info from the 'SQL in a
Nutshell'
  book, so they may not work (I don't use any of these databases).
  - PostgreSQL doesn't have a three argument position function, so I
didn't

 It is simply two functions

 position(?2 in substring(?1 from ?3))+?3



  map it.
  - Send me any corrections or change it your self.
  - If not mapping is provided the system defaults to {fn concat(param1,
  param2)} style functions.
 
  The mappings follow this message.
 
  -dain
 
 
  Oracle:
  function-mapping
  function-nameconcat/function-name
  function-sql(?1 || ?2)/function-sql
  /function-mapping
  function-mapping
  function-namesubstring/function-name
  function-sqlsubstr(?1, ?2, ?3)/function-sql
  /function-mapping
  function-mapping
  function-namelength/function-name
  function-sqllen(?1)/function-sql
  /function-mapping
  function-mapping
  function-namelocate/function-name
  function-sqlinstr(?1, ?2, ?3)/function-sql
  /function-mapping
  function-mapping
  function-nameabs/function-name
  function-sqlabs(?1)/function-sql
  /function-mapping
  function-mapping
  function-namesqrt/function-name
  function-sqlsqrt(?1)/function-sql
  /function-mapping
 
 
  MS SQLServer:
  function-mapping
  function-nameconcat/function-name
  function-sql(?1 + ?2)/function-sql
  /function-mapping
  function-mapping
  function-namesubstring/function-name
  function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
  /function-mapping
  function-mapping
  function-namelength/function-name
  function-sqllen(?1)/function-sql
  /function-mapping
  function-mapping
  function-namelocate/function-name
  function-sqlcharindex(?1, ?2, ?3)/function-sql
  /function-mapping
  function-mapping
  function-nameabs/function-name
  function-sqlabs(?1)/function-sql
  /function-mapping
  function-mapping
  function-namesqrt/function-name
  function-sqlsqrt(?1)/function-sql
  /function-mapping
 
  MySQL:
  function-mapping
  function-nameconcat/function-name
  function-sqlconcat(?1, ?2)/function-sql
  /function-mapping
  function-mapping
  function-namesubstring/function-name
  function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
  /function-mapping
  function-mapping
  function-namelength/function-name
  function-sqllength(?1)/function-sql
  /function-mapping
  function-mapping
  function-namelocate/function-name
  function-sqllocate(?1, ?2, ?3)/function-sql
  /function-mapping
  function-mapping
  function-nameabs/function-name
  function-sqlabs(?1)/function-sql
  /function-mapping
  function-mapping
  function-namesqrt/function-name
  function-sqlsqrt(?1)/function-sql
  /function-mapping
 
  PostgreSQL:
  function-mapping
  function-nameconcat/function-name
  function-sql(?1 || ?2)/function-sql
  /function-mapping
  function-mapping
  function-namesubstring/function-name
  function-sqlsubstring(?1 FROM ?2 FOR ?3)/function-sql
  /function-mapping
  function-mapping
  function-namelength/function-name
  function-sqllength(?1)/function-sql
  /function-mapping
  function-mapping
  function-nameabs/function-name
  function-sqlabs(?1)/function-sql
  /function-mapping
  function-mapping
  function-namesqrt/function-name
  function-sqlsqrt(?1)/function-sql
  /function-mapping
 
 
 
  ___
  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



Re: [JBoss-dev] ejbLoad() on a modified bean w/o ejbStore()

2001-08-20 Thread Dain Sundstrom

Jason,

Are you using jaws or cmp?

-dain

- Original Message -
From: Jason Dillon [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 20, 2001 5:38 PM
Subject: Re: [JBoss-dev] ejbLoad() on a modified bean w/o ejbStore()


 I just checked an the same behavior exists with the
 SimplePessimisticEJBLock.  =(

 --jason


 On Mon, 20 Aug 2001, Jason Dillon wrote:

  I am running into another odd problem, this time it looks like ejbLoad()
is
  being called on a modified entity with out ejbStore() being called
first.
  I am not really sure why this would happen, nor do I know where to start
  looking.
 
  I am using isModified() to show that an entity has changed.  The current
  impl simply logs a message and returns a boolean flag.  I implemented a
  setModified(), which sets that flag to true and logs a message.  I am
seeing
  bean is modified message, then shortly after on the same entity I see an
  ejbLoad() but there is no message about checking if the entity has been
  modified.
 
  This might be caused by two different threads accessing the bean, so the
tx
  might be confused... but it is my understanding that this should work.
 
  Essentially one user thread invokes a SFSB in a loop.  This bean creates
  jms messages.  A MDB on another machine does something with the message
and
  sends a response message back.  Then another MDB in the same VM as the
SFSB
  takes the message and updates 3 entities that were created by the SFSB
to
  track the message.
 
  Due to this problem, the bookkeeping for the messages are inconsistent,
which
  more or less breaks the application completely.
 
  Is it possible that this might be caused by the new locking system?  I
am
  currently use the QueuedPessimisticEJBLock locking policy on all
entities.
  I might try SimplePessimisticEJBLock, but I wanted to get some input
from
  the experts first, as to why this might be happening.
 
  At first I thought that there might be more than one Entity per PK being
  created, but I am not seeing that.
 
  If someone could advise me on where I can look to find out more how this
  works it would really be appreciated.
 
  --jason
 
 
  ___
  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



  1   2   3   4   5   6   7   8   9   10   >