RE: [JBoss-dev] SAR for the dummies?
Hello David, I think until marc shows us what he has been up to you will either have to deploy 2 packages by hand in the right order or deploy 2 packages and include a depends tag in the mbean config referring to the Container mbean for the entity. With luck, this will force the service mbean to wait until the entity is deployed. I don't know if the Container is actually participating fully in the dependency management scheme. I will check if such a complicated solution is possible ;) You might also try putting everything in an ear, embedding both the jar and sar. There is some code to deploy sar in ears but I don't know if it works. You will probably also have to use the depends trick since I believe sars should be deployed first by default. I may take a look at it. But on the other hand, if Marc is about to commit everything I need... Anyway, thank you for your help David. Cheers, Sacha ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Autogenerated primary keys etc
Dain, I thought a little more and understood that the Castor KeyGenerators can't be used standalone. They should be adapted to JBoss CMP 2.0, but we can use the existing codebase. The reason why not all of the key generators can be used standalone is that some them need SELECT with lock (SELECT FOR UPDATE) and they use some other Castor classes to get the query with database-specific syntax, while JBoss CMP 2.0 has it's own means for that, if I'm not mistaken. I propose that you think about the best way of plugging key generators in, then I'll adapt the Castor code. Please read http://castor.exolab.org/key-generator.html to get a general idea about them and to see the list of supported databases and algorithms. Also see the KeyGenerator interface below, please read the comments. Oleg /** * Interface for a key generator. The key generator is used for * producing identities for objects before they are created in the * database. * p * All the key generators belonging to the same database share the * same non-transactional connection to the database. * p * The key generator is configured from the mapping file using * Bean-like accessor methods. * * @author a href=[EMAIL PROTECTED]Assaf Arkin/a * @author a href=[EMAIL PROTECTED]Oleg Nitz/a * @version $Revision: 1.7 $ $Date: 2000/12/17 15:40:44 $ */ public interface KeyGenerator { /** * For the key generators of BEFORE_INSERT style {@link #generateKey} * is called before INSERT. * {@link #patchSQL} may be used but usually doesn't. */ public static final byte BEFORE_INSERT = -1; /** * For the key generators of DURING_INSERT style {@link #generateKey} * is never called, all work is done by {@link #patchSQL}. */ public static final byte DURING_INSERT = 0; /** * For the key generators of AFTER_INSERT style {@link #generateKey} * is called after INSERT. * {@link #patchSQL} may be used but usually doesn't. */ public static final byte AFTER_INSERT = 1; /** * Generate a new key for the specified table. This method is * called when a new object is about to be created. In some * environments the name of the owner of the object is known, * e.g. the principal in a J2EE server. * This method is never called for DURING_INSERT key generators. * * @param conn An open connection within the given transaction * @param tableName The table name * @param primKeyName The primary key name * @param props A temporary replacement for Principal object * @return A new key * @throws PersistenceException An error occured talking to persistent * storage */ public Object generateKey( Connection conn, String tableName, String primKeyName, Properties props ) throws PersistenceException; /** * Style of the key generator: BEFORE_INSERT, DURING_INSERT or AFTER_INSERT. */ public byte getStyle(); /** * Gives a possibility to patch the Castor-generated SQL statement * for INSERT (indended mainly for DURING_INSERT style of key generators, * other key generators usually simply return the passed parameter). * The original statement contains primary key column on the first place * for BEFORE_INSERT style and doesn't contain it for the other styles. * This method is called once for each class and must return String * with '?' that can be passed to CallableStatement (for DURING_INSERT * style) or to PreparedStatement (for the others). * Then for each record being created actual field values are substituted, * starting from the primary key value for BEFORE_INSERT style, of starting * from the first of other fields for the other styles. * The DURING_INSERT key generator must add one OUT parameter to the end * of the parameter list, which will return the generated identity. * For example, ReturningKeyGenerator for Oracle8i transforms * INSERT INTO tbl (pk, fld1, ...,fldN) VALUES (?,?...,?) to * INSERT INTO tbl (pk, fld1, ...) VALUES (seq.nextval,?,?) * RETURNING pk INTO ?. * DURING_INSERT key generator also may be implemented as a stored procedure. * @param insert Castor-generated INSERT statement * @param primKeyName The primary key name */ public String patchSQL( String insert, String primKeyName ) throws MappingException; /** * Is key generated in the same connection as INSERT? * For DURING_INSERT style this method is never called. */ public boolean isInSameConnection(); // this one should be dropped } Dain Sundstrom wrote: Cool. I think we should look at using this post beta. -dain -Original Message- From: Oleg Nitz [mailto:[EMAIL PROTECTED]] Sent: Monday, January 14, 2002 10:23 AM To: Dain Sundstrom Subject: Re: [JBoss-dev] Autogenerated primary keys etc Dain Sundstrom wrote: If you want to
RE: [JBoss-dev] jboss 2.4.4: CMP field of primitive type and NULL database value
Can you put this in the bug database? I've been meaning to fix this for awhile. I've run into this 2 hours wasted problem as well and fixed it on my last project but never checked it into CVS. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alexey Yudichev Sent: Tuesday, January 15, 2002 10:03 AM To: [EMAIL PROTECTED] Subject: [JBoss-dev] jboss 2.4.4: CMP field of primitive type and NULL database value While loading entity in the case of SUBJ java.lang.reflect.Field.set() throws NullPointerException like this: java.lang.NullPointerException at java.lang.reflect.Field.set(Native Method) at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFieldValue(J DBCCommand.jav a:651) at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.loadOneE ntity(JDBCLoad EntityCommand.java:217) ... I suppose it should be wrapped by more informative exception with the message like cannot set the value CMP field of primitive type to NULL. I spent 2 hours today finding the cause :) Best wishes, Alexei Yudichev mailto:[EMAIL PROTECTED] ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] SAR for the dummies?
marc is not about to commit everything you need, he just came back from denver on 5 hours of sleep in 2 days, still needs to finish the training updates for boston, then try to salvage the data from the ide that crashed then print the trainings then if we are not at friday yet i can look at the deployer code. sorry marcf |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of Sacha |Labourey |Sent: Tuesday, January 15, 2002 12:48 AM |To: David Jencks; [EMAIL PROTECTED] |Subject: RE: [JBoss-dev] SAR for the dummies? | | |Hello David, | | I think until marc shows us what he has been up to you will |either have to | deploy 2 packages by hand in the right order or deploy 2 packages and | include a depends tag in the mbean config referring to the |Container mbean | for the entity. With luck, this will force the service mbean to | wait until | the entity is deployed. I don't know if the Container is actually | participating fully in the dependency management scheme. | |I will check if such a complicated solution is possible ;) | | You might also try putting everything in an ear, embedding both | the jar and | sar. There is some code to deploy sar in ears but I don't know if it | works. You will probably also have to use the depends trick since I | believe sars should be deployed first by default. | |I may take a look at it. But on the other hand, if Marc is about to commit |everything I need... | |Anyway, thank you for your help David. Cheers, | | | | Sacha | | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] SAR for the dummies?
hello, marc is not about to commit everything you need, he just came back from denver on 5 hours of sleep in 2 days, 5 hours in 2 days? It was a great party ?!? ;) Thank you for putting the server up again: hardware crashes are always terribly time consuming! still needs to finish the training updates for boston, then try to salvage the data from the ide that crashed then print the trainings then if we are not at friday yet i can look at the deployer code. It was just a question, I don't need it so quickly personnaly: I first need to do some testing on my stuff and test the integration with Jules. The SAR thing will be useful for public usage. cheers, Sacha ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] SAR for the dummies?
i will really try to get that to you before i leave for boston, promised, i will really try supermarc marcf |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of Sacha |Labourey |Sent: Tuesday, January 15, 2002 8:02 AM |To: marc fleury; David Jencks; [EMAIL PROTECTED] |Subject: RE: [JBoss-dev] SAR for the dummies? | | |hello, | | marc is not about to commit everything you need, he just came back from | denver on 5 hours of sleep in 2 days, | |5 hours in 2 days? It was a great party ?!? ;) | |Thank you for putting the server up again: hardware crashes are always |terribly time consuming! | | still needs to finish the training | updates for boston, then try to salvage the data from the ide |that crashed | then print the trainings then if we are not at friday yet i can | look at the | deployer code. | |It was just a question, I don't need it so quickly personnaly: I first need |to do some testing on my stuff and test the integration with Jules. The SAR |thing will be useful for public usage. | |cheers, | | | | Sacha | | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: tools/lib xdoclet.jar
User: d_jencks Date: 02/01/15 08:45:56 Modified:lib xdoclet.jar Log: updated to xdoclet 1.1 Revision ChangesPath 1.2 +1382 -496 tools/lib/xdoclet.jar Binary file ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: admin build.xml
User: d_jencks Date: 02/01/15 08:45:55 Modified:.build.xml Log: updated to xdoclet 1.1 Revision ChangesPath 1.12 +2 -1 admin/build.xml Index: build.xml === RCS file: /cvsroot/jboss/admin/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- build.xml 2001/12/06 02:16:05 1.11 +++ build.xml 2002/01/15 16:45:55 1.12 @@ -12,7 +12,7 @@ !---- !-- == -- -!-- $Id: build.xml,v 1.11 2001/12/06 02:16:05 user57 Exp $ -- +!-- $Id: build.xml,v 1.12 2002/01/15 16:45:55 d_jencks Exp $ -- project default=main name=JBoss/Admin @@ -238,6 +238,7 @@ fileset dir=${source.java} include name=org/jboss/admin/beans/*Bean.java / /fileset + packageSubstitution packages=beans substituteWith=interfaces/ remoteinterface/ homeinterface/ session/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: contrib/jetty build.xml
User: d_jencks Date: 02/01/15 08:45:55 Modified:jettybuild.xml Log: updated to xdoclet 1.1 Revision ChangesPath 1.21 +1 -0 contrib/jetty/build.xml Index: build.xml === RCS file: /cvsroot/jboss/contrib/jetty/build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- build.xml 2002/01/13 21:30:13 1.20 +++ build.xml 2002/01/15 16:45:55 1.21 @@ -267,6 +267,7 @@ fileset dir=${source.java} include name=**/ejb/*Bean.java / /fileset + packageSubstitution packages=ejb substituteWith=interfaces/ dataobject/ remoteinterface/ localinterface/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss build.xml
User: d_jencks Date: 02/01/15 08:45:56 Modified:.build.xml Log: updated to xdoclet 1.1 Revision ChangesPath 1.50 +3 -1 jboss/build.xml Index: build.xml === RCS file: /cvsroot/jboss/jboss/build.xml,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- build.xml 2002/01/03 04:00:56 1.49 +++ build.xml 2002/01/15 16:45:55 1.50 @@ -12,7 +12,7 @@ !---- !-- == -- -!-- $Id: build.xml,v 1.49 2002/01/03 04:00:56 user57 Exp $ -- +!-- $Id: build.xml,v 1.50 2002/01/15 16:45:55 d_jencks Exp $ -- project default=main name=JBoss/Server @@ -338,6 +338,7 @@ include name=org/jboss/jmx/adaptor/ejb/*Bean.java/ exclude name=org/jboss/jmx/adaptor/ejb/*MBean.java/ /fileset + packageSubstitution packages=ejb substituteWith=interfaces/ remoteinterface/ homeinterface/ session/ @@ -358,6 +359,7 @@ include name=org/jboss/management/mejb/*Bean.java/ exclude name=org/jboss/management/mejb/*MBean.java/ /fileset + packageSubstitution packages=ejb substituteWith=interfaces/ remoteinterface/ homeinterface/ session/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Open House in Boston, Wednesday Jan 23, 2002,
Come meet marc and scott, We will be holding an informal Open House at the lenox hotel in back bay in the combined heritage 1 and 2 rooms (where we hold the training). http://www.lenoxhotel.com/hotels/lenox/ it will start at 7 PM and we can go on as long as we standup. Tell your friends and colleagues to come meet us in the flesh and ask us any questions you want. marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Atlanta java user group tonight JAN 15 2002
for those in the Atlanta GA region, I was invited at the last minute to go and crash an industry patting on the back session. http://www.ajug.org/meetings/2002/jan02.html It is the Atlanta user group and we are there to talk about the different app servers. I plan on sticking to a very simple presentation, we are free and don't suck, how about you? So come tonight if you can or tell your friends and colleagues and try to show up. regards marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Atlanta java user group tonight JAN 15 2002
Hey Marc, I plan on sticking to a very simple presentation, we are free and don't suck, how about you? Isn't this too complex (maybe) ? ;) Ahh, it's a pity I cannot come... Simon ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] SYDNEY WE ARE ON
Ok, after a quick internal deliberation with my board of directors (my wife) we have decided to hold the Sydney training session. If you remember correctly, the scare was that there wasn't enough registration for Sydney even after a dramatic price decrease. You guys are a bunch of cheap asses. Turns out enough of you guys have registered and we won't be losing money on this, we will even be making some AU$ that I might as well gamble away at the casino seeing how the AU$ isn't worth much. Also this is probably the only time I am going to go there, unless the Australian dollar becomes a first world currency. Next time I am going to Hong Kong! So Sydney here I come, Scott says no way he is going, no way he is ditching prime ski season for you cheap bastards, fuck you. So I will be alone and seriously jet-lagged, it is a 2 day trip for me, so you guys better make it worth my time and show up. So we are on Sydney, the JBoss road show will hit down under, and tell your friends, get your money from your stingy bosses and come to this unique and one-time event. Cheers mates marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] manuals should be back online
let me know if something is wrong marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Cover idea for upcoming JBoss book
Sorry to hear you server crash. Maybe this funny book cover idea make you feel better: http://photos.yahoo.com/bc/jbwoo/vwp2?.tok=bclLHEPBgMgiDocV.dir=/shared.dnm=jbbc.gif.gif.src=ph __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] FW: deployer stuff
FYI conversation between Scott and I, if I don't have time to work on this this week I will commit the work as is, which compiles and runs fairly well but hasn't been fully tested and exposes a few bugs still. I trust that if I drop the JBossDeployer in your lap you guys will whip in shape in 32 seconds flat The features are full integration of deployer architecture, Main deployer talking to sub-*ar*-specific deployers, full support for run-time pluggability of deployers as services. Unlimited number of deployers supported support for hot adding directories to the watched directories at runtime full integration of classloader generation so as to have the same class visibility integration across EVERYTHING, not just the services stack but also the war the ejb and just *everything* so your services classes will dynamically see your ear classes support for packaged and unpacked mode (directory) support for bare-xml files and structures, no classes just metadata, put classes on web "drop anything" support in deploy, directories, sar, jar/rar/ear/war/ classes,xml snippets, anything support for arbitrary sub packaging, want to do an EJB that deploys a service which contains an EJB and a SAR, plus a directory and a couple of classes that talk to a ear inside the packaging? knock yourself out, we take care of classloaders. support for hot redeploy of *anything*, just like we did applications hot deploy without compilation, the new JBoss Deployer support hot deploy and redeploy of server modules, rars, sars, classes, jar war anything simplified codebase, really really simple, really so I will try to commit soon marcf -Original Message-From: Scott M Stark [mailto:[EMAIL PROTECTED]]Sent: Tuesday, January 15, 2002 10:10 AMTo: marc fleurySubject: Re: deployer stuff Personally I don't care as this is alpha and there are no guarentees. - Original Message - From: marc fleury To: Scott M Stark Sent: Tuesday, January 15, 2002 12:58 PM Subject: RE: deployer stuff ok I am thinking of something ballsy just commit as is, which in itself will take me a day given all the changes that have happened since my last update and just let you guys debug it, what do you think? marcf -Original Message-From: Scott M Stark [mailto:[EMAIL PROTECTED]]Sent: Tuesday, January 15, 2002 10:02 AMTo: marc fleurySubject: deployer stuff If your not going to have time you can tar up your work and I'll do the final testing and merge.
RE: [JBoss-dev] Cover idea for upcoming JBoss book
this is funny marcf |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of John |Woo |Sent: Tuesday, January 15, 2002 10:09 AM |To: [EMAIL PROTECTED] |Subject: [JBoss-dev] Cover idea for upcoming JBoss book | | |Sorry to hear you server crash. Maybe this funny book |cover idea make you feel better: | |http://photos.yahoo.com/bc/jbwoo/vwp2?.tok=bclLHEPBgMgiDocV.di |r=/shared.dnm=jbbc.gif.gif.src=ph | | |__ |Do You Yahoo!? |Send FREE video emails in Yahoo! Mail! |http://promo.yahoo.com/videomail/ | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Atlanta java user group tonight JAN 15 2002
Most wonderful. I be there. Make your time. --- marc fleury [EMAIL PROTECTED] wrote: for those in the Atlanta GA region, I was invited at the last minute to go and crash an industry patting on the back session. http://www.ajug.org/meetings/2002/jan02.html It is the Atlanta user group and we are there to talk about the different app servers. I plan on sticking to a very simple presentation, we are free and don't suck, how about you? So come tonight if you can or tell your friends and colleagues and try to show up. regards marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Cover idea for upcoming JBoss book
I really want to write Touching your wee-wee with shitty pompous architecture and design And an article for those buffon at Dr Dobbs The false intellectualism of object oriented software programming and would obliterate Grow a fancy goatee, pretend you can architect, and impress girls Make a fortune as an impostor in 21 days The monkey farting around is a really good cover marcf I love the wall-paper pattern - someone at Dresdner bank UK- |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of John |Woo |Sent: Tuesday, January 15, 2002 10:09 AM |To: [EMAIL PROTECTED] |Subject: [JBoss-dev] Cover idea for upcoming JBoss book | | |Sorry to hear you server crash. Maybe this funny book |cover idea make you feel better: | |http://photos.yahoo.com/bc/jbwoo/vwp2?.tok=bclLHEPBgMgiDocV.di |r=/shared.dnm=jbbc.gif.gif.src=ph | | |__ |Do You Yahoo!? |Send FREE video emails in Yahoo! Mail! |http://promo.yahoo.com/videomail/ | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Cover idea for upcoming JBoss book
Laughing so hard my sides hurt. You might like to make your own cover: http://www.ilbbs.com/oracovers/ --- marc fleury [EMAIL PROTECTED] wrote: I really want to write Touching your wee-wee with shitty pompous architecture and design And an article for those buffon at Dr Dobbs The false intellectualism of object oriented software programming and would obliterate Grow a fancy goatee, pretend you can architect, and impress girls Make a fortune as an impostor in 21 days The monkey farting around is a really good cover marcf I love the wall-paper pattern - someone at Dresdner bank UK- |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of John |Woo |Sent: Tuesday, January 15, 2002 10:09 AM |To: [EMAIL PROTECTED] |Subject: [JBoss-dev] Cover idea for upcoming JBoss book | | |Sorry to hear you server crash. Maybe this funny book |cover idea make you feel better: | |http://photos.yahoo.com/bc/jbwoo/vwp2?.tok=bclLHEPBgMgiDocV.di |r=/shared.dnm=jbbc.gif.gif.src=ph | | |__ |Do You Yahoo!? |Send FREE video emails in Yahoo! Mail! |http://promo.yahoo.com/videomail/ | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] BOSTON last CALL!
Folks, Boston sold really well and we are sold out at 20. We will include a couple more places for late registrations but not many and this is on a first come first serve basis. So if you were thinking of coming to the training and you live on the east coast hurry up, speed it up, and register with us at [EMAIL PROTECTED] or visit online for more information on next weeks training regards marcf ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] [ jboss-Bugs-474977 ] run.sh fails on Mac OS X
Bugs item #474977, was opened at 2001-10-25 10:59 You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=474977group_id=22866 Category: JBossServer Group: v2.4 (stable) Status: Closed Resolution: Fixed Priority: 5 Submitted By: Matthew Bishop (mattbishop) Assigned to: Andreas Schaefer (schaefera) Summary: run.sh fails on Mac OS X Initial Comment: The run.sh script in JBoss 2.4.1a and 2.4.3 incorrectly identifies a HotSpot Server VM and then tries to instantiate the VM with the '-server' option. This fails if the VM is indeed a HotSpot Client VM and not the server variety. Mac OS X does not ship with a server HotSpot, so the run.sh script fails when it tries to instantiate the VM. Here is a sample output: [localhost:/J2EE-servers/jboss/bin] matt% sh run.sh Unrecognized option: -server Could not create the Java virtual machine. Here is the output from Mac OS X 10.1 when checking the version: [localhost:/J2EE-servers/jboss/bin] matt% java -version java version 1.3.1 Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-root-010902-18:51) Java HotSpot(TM) Client VM (build 1.3.1, mixed mode) My workaround is to edit the run.sh script and remove the $HOTSPOT variable from the instantiation line. -- Comment By: Loren Rosen (lorenrosen) Date: 2002-01-15 12:22 Message: Logged In: YES user_id=387536 Perhaps run.sh should invoke 'java -help' and check the output for the string -server to verify that the option is supported. -- Comment By: Andreas Schaefer (schaefera) Date: 2001-11-16 15:23 Message: Logged In: YES user_id=70434 Current CVS Branch_2_4 contains the fix. Andy -- You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=474977group_id=22866 ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCAbstractCMPFieldBridge.java
User: dsundstrom Date: 02/01/15 12:43:57 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCAbstractCMPFieldBridge.java Log: Changed construction of EJBException to pass the wrap exception instead of embeding only the exception message. Revision ChangesPath 1.10 +6 -8 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCAbstractCMPFieldBridge.java Index: JDBCAbstractCMPFieldBridge.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCAbstractCMPFieldBridge.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JDBCAbstractCMPFieldBridge.java 2001/11/26 03:12:26 1.9 +++ JDBCAbstractCMPFieldBridge.java 2002/01/15 20:43:56 1.10 @@ -20,7 +20,6 @@ import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCCMPFieldMetaData; -import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager; import org.jboss.ejb.plugins.cmp.jdbc.JDBCType; import org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil; @@ -41,7 +40,7 @@ * One for each entity bean cmp field. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public abstract class JDBCAbstractCMPFieldBridge implements JDBCCMPFieldBridge { protected JDBCStoreManager manager; @@ -114,7 +113,7 @@ } catch(Exception e) { // Non recoverable internal exception throw new EJBException(Internal error getting primary key + - field member + getFieldName() + : + e); + field member + getFieldName(), e); } } @@ -145,7 +144,7 @@ } catch(Exception e) { // Non recoverable internal exception throw new EJBException(Internal error setting instance field + - getFieldName() + : + e); + getFieldName(), e); } } @@ -219,7 +218,7 @@ } catch(SQLException e) { // Non recoverable internal exception throw new EJBException(Internal error setting parameters for field + - getFieldName() + : + e); + getFieldName(), e); } } @@ -243,9 +242,8 @@ throw e; } catch(Exception e) { // Non recoverable internal exception - e.printStackTrace(); throw new EJBException(Internal error getting results for field + - getFieldName() + : + e); + getFieldName(), e); } } @@ -291,7 +289,7 @@ } catch(SQLException e) { // Non recoverable internal exception throw new EJBException(Internal error getting results + - for field member + getFieldName() + : + e); + for field member + getFieldName(), e); } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCFieldBridge.java
User: dsundstrom Date: 02/01/15 12:46:30 Added: src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCFieldBridge.java Log: New mered CMR field and CMP field interface. Revision ChangesPath 1.1 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCFieldBridge.java Index: JDBCFieldBridge.java === /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.ejb.plugins.cmp.jdbc.bridge; import java.sql.PreparedStatement; import java.sql.ResultSet; import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.ejb.plugins.cmp.bridge.FieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.JDBCType; public interface JDBCFieldBridge extends FieldBridge { /** * Gets the JDBC type of this field. */ public JDBCType getJDBCType(); /** * Is this field a member of the primary key. * @return true if this field is a member of the primary key */ public boolean isPrimaryKeyMember(); /** * Has current data read timed out? */ public boolean isReadTimedOut(EntityEnterpriseContext ctx); /** * Has the data been loaded? */ public boolean isLoaded(EntityEnterpriseContext ctx); /** * Set CMPFieldValue to Java default value (i.e., 0 or null). */ public void initInstance(EntityEnterpriseContext ctx); /** * Resets any persistence data maintained in the context. */ public void resetPersistenceContext(EntityEnterpriseContext ctx); /** * Sets the prepared statement parameters with the data from the * instance associated with the context. */ public int setInstanceParameters( PreparedStatement ps, int parameterIndex, EntityEnterpriseContext ctx); /** * Loads the data from result set into the instance associated with * the specified context. */ public int loadInstanceResults( ResultSet rs, int parameterIndex, EntityEnterpriseContext ctx); /** * Loads the value of this cmp field from result set into argument referance. */ public int loadArgumentResults( ResultSet rs, int parameterIndex, Object[] argumentRef); /** * Has the value of this field changes since the last time clean was called. */ public boolean isDirty(EntityEnterpriseContext ctx); /** * Mark this field as clean. */ public void setClean(EntityEnterpriseContext ctx); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP1xFieldBridge.java
User: dsundstrom Date: 02/01/15 12:48:18 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP1xFieldBridge.java Log: Fixed creation of EJBException to wrap exception instead of embeding it into the exception message. Fixed minor formating errors. Revision ChangesPath 1.10 +28 -10 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JDBCCMP1xFieldBridge.java 2001/12/02 01:41:46 1.9 +++ JDBCCMP1xFieldBridge.java 2002/01/15 20:48:16 1.10 @@ -35,7 +35,7 @@ * One for each entity bean cmp field. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public class JDBCCMP1xFieldBridge extends JDBCAbstractCMPFieldBridge { private Field field; @@ -57,28 +57,45 @@ } public Object getInstanceValue(EntityEnterpriseContext ctx) { + FieldState fieldState = getFieldState(ctx); + if(!fieldState.isLoaded) { + throw new EJBException(CMP 1.1 field not loaded: + getFieldName()); + } + try { return field.get(ctx.getInstance()); } catch(Exception e) { // Non recoverable internal exception throw new EJBException(Internal error getting instance field + - getFieldName() + : + e); + getFieldName(), e); } } public void setInstanceValue(EntityEnterpriseContext ctx, Object value) { + if(isPrimaryKeyMember() manager.getEntityBridge().isCreated(ctx)) { +// throw new IllegalStateException(A field that is a member + +// of the primary key can only be set in ejbCreate); + } + try { field.set(ctx.getInstance(), value); + + FieldState fieldState = getFieldState(ctx); + fieldState.isLoaded = true; } catch(Exception e) { // Non recoverable internal exception throw new EJBException(Internal error setting instance field + - getFieldName() + : + e); + getFieldName(), e); } } + + public boolean isLoaded(EntityEnterpriseContext ctx) { + return getFieldState(ctx).isLoaded; + } - /** - * Has the value of this field changes since the last time clean was called. - */ + /** +* Has the value of this field changes since the last time clean was called. +*/ public boolean isDirty(EntityEnterpriseContext ctx) { // read only and primary key fields are never dirty if(isReadOnly() || isPrimaryKeyMember()) { @@ -90,10 +107,10 @@ } /** - * Mark this field as clean. - * Saves the current state in context, so it can be compared when - * isDirty is called. - */ +* Mark this field as clean. +* Saves the current state in context, so it can be compared when +* isDirty is called. +*/ public void setClean(EntityEnterpriseContext ctx) { FieldState fieldState = getFieldState(ctx); fieldState.originalValue = getInstanceValue(ctx); @@ -133,6 +150,7 @@ } private static class FieldState { + boolean isLoaded = false; Object originalValue; long lastRead = -1; } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] [AUTOMATED] JBoss compilation failed
= ==THIS IS AN AUTOMATED EMAIL - SEE http://www.lubega.com FOR DETAILS= = HERE ARE THE LAST 50 LINES OF THE LOG FILE if(!fromCMPFieldBridge.getFieldType().equals(toCMPFieldBridge.getFieldType())) { ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLTarget.java:610: cannot resolve symbol symbol : method getFieldType () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge if(!fromCMPFieldBridge.getFieldType().equals(toCMPFieldBridge.getFieldType())) { ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java:160: cannot resolve symbol symbol : method getFieldName () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge JDBCCMPFieldBridge childPkField = cmrFieldBridge.getRelatedEntity().getCMPFieldByName(parentFkField.getFieldName()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java:170: cannot resolve symbol symbol : method getFieldName () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge JDBCCMPFieldBridge parentPkField = parent.getCMPFieldBridge(childFkKeyField.getFieldName()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java:183: cannot resolve symbol symbol : method getFieldName () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge JDBCCMPFieldBridge pkField = parent.getCMPFieldBridge(fkField.getFieldName()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java:195: cannot resolve symbol symbol : method getFieldName () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge JDBCCMPFieldBridge pkField = cmrFieldBridge.getRelatedEntity().getCMPFieldByName(fkField.getFieldName()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/QueryParameter.java:185: cannot resolve symbol symbol : method isPrimaryKeyMember () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge if(!field.isPrimaryKeyMember()) { ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/QueryParameter.java:239: cannot resolve symbol symbol : method getFieldName () location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge parameterBuf.append(.).append(field.getFieldName()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/QueryParameter.java:270: cannot resolve symbol symbol : method getPrimaryKeyValue (java.lang.Object) location: interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge arg = field.getPrimaryKeyValue(arg); ^ 51 errors 4 warnings BUILD FAILED /disk/orig/home/lubega/jbossro/jboss-all/server/build.xml:385: Compile failed, messages should have been provided. Total time: 1 minute 4 seconds ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP2xFieldBridge.java
User: dsundstrom Date: 02/01/15 12:49:11 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP2xFieldBridge.java Log: Added isLoaded method. Revision ChangesPath 1.10 +10 -1 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JDBCCMP2xFieldBridge.java 2001/12/02 01:41:46 1.9 +++ JDBCCMP2xFieldBridge.java 2002/01/15 20:49:11 1.10 @@ -32,7 +32,7 @@ * One for each entity bean cmp field. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public class JDBCCMP2xFieldBridge extends JDBCAbstractCMPFieldBridge { @@ -64,6 +64,11 @@ } public void setInstanceValue(EntityEnterpriseContext ctx, Object value) { + if(isPrimaryKeyMember() manager.getEntityBridge().isCreated(ctx)) { +// throw new IllegalStateException(A field that is a member + +// of the primary key can only be set in ejbCreate); + } + FieldState fieldState = getFieldState(ctx); // short-circuit to avoid repetive comparisons @@ -77,6 +82,10 @@ // update current value fieldState.value = value; + } + + public boolean isLoaded(EntityEnterpriseContext ctx) { + return getFieldState(ctx).isLoaded; } /** ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/bridge FieldBridge.java EntityBridge.java EntityBridgeInvocationHandler.java SelectorBridge.java CMPFieldBridge.java CMRFieldBridge.java
User: dsundstrom Date: 02/01/15 12:40:15 Modified:src/main/org/jboss/ejb/plugins/cmp/bridge EntityBridge.java EntityBridgeInvocationHandler.java SelectorBridge.java Added: src/main/org/jboss/ejb/plugins/cmp/bridge FieldBridge.java Removed: src/main/org/jboss/ejb/plugins/cmp/bridge CMPFieldBridge.java CMRFieldBridge.java Log: Merged CMR field and CMP field interfaces, because from the view of the invocation interceptor a field is a field is a field. Converted field arrays to Lists for better safty and easier handling. Revision ChangesPath 1.5 +5 -23 jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/EntityBridge.java Index: EntityBridge.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/bridge/EntityBridge.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EntityBridge.java 2001/11/02 18:21:22 1.4 +++ EntityBridge.java 2002/01/15 20:40:15 1.5 @@ -7,7 +7,8 @@ package org.jboss.ejb.plugins.cmp.bridge; -import org.jboss.ejb.EntityEnterpriseContext; +import java.util.Collection; +import java.util.List; /** * EntityBridge follows the Bridge pattern [Gamma et. al, 1995]. @@ -23,30 +24,11 @@ * One per cmp entity bean type. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public interface EntityBridge { public String getEntityName(); - public Class getPrimaryKeyClass(); - public CMPFieldBridge[] getPrimaryKeyFields(); - - public CMPFieldBridge[] getCMPFields(); - public CMRFieldBridge[] getCMRFields(); - public SelectorBridge[] getSelectors(); - - /** -* Has the instance in the context passed through ejbCreate? -*/ - public boolean isCreated(EntityEnterpriseContext ctx); - - /** -* Mark each field every as clean. -*/ - public void setClean(EntityEnterpriseContext ctx); - - /** -* Get every field that isDirty -*/ - public CMPFieldBridge[] getDirtyFields(EntityEnterpriseContext ctx); + public List getFields(); + public Collection getSelectors(); } 1.11 +58 -141 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- EntityBridgeInvocationHandler.java2001/12/12 19:43:11 1.10 +++ EntityBridgeInvocationHandler.java2002/01/15 20:40:15 1.11 @@ -10,8 +10,10 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.Map; +import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; import javax.ejb.EJBException; @@ -33,16 +35,15 @@ * One per cmp entity bean instance, including beans in pool. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public class EntityBridgeInvocationHandler implements InvocationHandler { - protected EntityContainer container; - protected EntityBridge entityBridge; - protected Class beanClass; - protected EntityEnterpriseContext ctx; - protected Map cmpFieldMap; - protected Map cmrFieldMap; - protected Map selectorMap; + private EntityContainer container; + private EntityBridge entityBridge; + private Class beanClass; + private EntityEnterpriseContext ctx; + private Map fieldMap; + private Map selectorMap; /** * Creates an invocation handler for the specified entity. @@ -61,10 +62,7 @@ this.entityBridge = entityBridge; this.beanClass = beanClass; - Map abstractAccessors = getAbstractAccessors(); - setupCMPFieldMap(abstractAccessors); - setupCMRFieldMap(abstractAccessors); - + setupFieldMap(); setupSelectorMap(); } @@ -79,53 +77,27 @@ throws Throwable { String methodName = method.getName(); - - // is this a cmp field accessor - CMPFieldBridge cmpField = (CMPFieldBridge) cmpFieldMap.get(method); - if(cmpField != null) { + + // is this a field accessor + FieldBridge field = (FieldBridge) fieldMap.get(method); + if(field != null) { if(methodName.startsWith(get)) { -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCEntityBridge.java
User: dsundstrom Date: 02/01/15 12:59:52 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCEntityBridge.java Log: Added getFields and getFieldByName to support merged CMR field and CMP field interface. Converted field arrays to java.util.Lists for better safty and easier handling. Added general load groups, where load groups are identified by name. Then lazy load groups only contain a list of named load groups. This is eases specification of the eager load group in read ahead metadata. Fixed creation of EJBException to wrap exceptions instead of embeding it in the message. Revision ChangesPath 1.19 +208 -197 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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- JDBCEntityBridge.java 2001/12/17 18:54:24 1.18 +++ JDBCEntityBridge.java 2002/01/15 20:59:52 1.19 @@ -11,8 +11,11 @@ import java.sql.ResultSet; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import javax.ejb.EJBException; @@ -28,8 +31,7 @@ import org.jboss.ejb.plugins.cmp.bridge.EntityBridge; import org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler; -import org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge; -import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge; +import org.jboss.ejb.plugins.cmp.bridge.FieldBridge; import org.jboss.ejb.plugins.cmp.bridge.SelectorBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData; @@ -51,29 +53,33 @@ * One per cmp entity bean type. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.18 $ + * @version $Revision: 1.19 $ */ public class JDBCEntityBridge implements EntityBridge { - protected JDBCEntityMetaData metadata; - protected JDBCStoreManager manager; + private JDBCEntityMetaData metadata; + private JDBCStoreManager manager; private DataSource dataSource; /** is the table assumed to exist */ - protected boolean tableExists; + private boolean tableExists; - protected JDBCCMPFieldBridge[] cmpFields; - protected Map cmpFieldsByName; - protected JDBCCMPFieldBridge[] primaryKeyFields; + private List fields; + private Map fieldsByName; - protected JDBCCMRFieldBridge[] cmrFields; - protected Map cmrFieldsByName; + private List cmpFields; + private Map cmpFieldsByName; + + private List primaryKeyFields; + + private List cmrFields; + private Map cmrFieldsByName; - protected JDBCSelectorBridge[] selectors; - protected Map selectorsByMethod; + private Map selectorsByMethod; - protected JDBCCMPFieldBridge[] eagerLoadFields; - protected ArrayList lazyLoadGroups; + private Map loadGroups; + private List eagerLoadFields; + private List lazyLoadGroups; public JDBCEntityBridge( JDBCEntityMetaData metadata, @@ -94,26 +100,38 @@ // CMP fields loadCMPFields(metadata); - // eager/load groups - loadEagerLoadFields(metadata); - loadLazyLoadGroups(metadata); - // CMR fields loadCMRFields(metadata); + // all fields list + fields = new ArrayList(cmpFields.size() + cmrFields.size()); + fields.addAll(cmpFields); + fields.addAll(cmrFields); + fields = Collections.unmodifiableList(fields); + fieldsByName = new HashMap(fields.size()); + fieldsByName.putAll(cmpFieldsByName); + fieldsByName.putAll(cmrFieldsByName); + fieldsByName = Collections.unmodifiableMap(fieldsByName); + + // load groups + loadLoadGroups(metadata); + loadEagerLoadGroup(metadata); + loadLazyLoadGroups(metadata); + // ejbSelect methods loadSelectors(metadata); } - protected void loadCMPFields(JDBCEntityMetaData metadata) + private void loadCMPFields(JDBCEntityMetaData metadata) throws DeploymentException { // map between field names and field objects cmpFieldsByName = new HashMap(metadata.getCMPFields().size()); - // non primary key cmp fields - ArrayList cmpFieldList = new ArrayList(metadata.getCMPFields().size()); + // only non pk fields are stored here at first and then later + // the pk fields are added to the front (makes sql easier to read) + cmpFields = new
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMRFieldBridge.java
User: dsundstrom Date: 02/01/15 13:04:49 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMRFieldBridge.java Log: Added methods required to support merged CMR field and CMP field interfaces. Converted field arrays to java.util.List. Converted value Sets to Lists to maintain order. This is required for read ahead of CMR fields. Fixed exception handling to avoid double wrapping of EJBExceptions. Revision ChangesPath 1.20 +330 -90 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.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JDBCCMRFieldBridge.java 2001/12/27 17:35:40 1.19 +++ JDBCCMRFieldBridge.java 2002/01/15 21:04:49 1.20 @@ -8,10 +8,15 @@ import java.lang.reflect.Method; import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import javax.ejb.EJBException; @@ -26,10 +31,11 @@ import org.jboss.invocation.Invocation; import org.jboss.ejb.plugins.CMPPersistenceManager; import org.jboss.ejb.plugins.EntityInstanceCache; -import org.jboss.ejb.plugins.cmp.bridge.CMRFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.JDBCContext; 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.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationshipRoleMetaData; import org.jboss.logging.Logger; @@ -47,9 +53,9 @@ * One for each role that entity has. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.19 $ + * @version $Revision: 1.20 $ */ -public class JDBCCMRFieldBridge implements CMRFieldBridge { +public class JDBCCMRFieldBridge implements JDBCFieldBridge { // -- Invocation messages -- /** tells the related continer to retrieve the id of the related entity */ @@ -110,14 +116,20 @@ /** * The key fields that this entity maintains in the relation table. */ - private JDBCCMPFieldBridge[] tableKeyFields; + private List tableKeyFields; /** * Foreign key fields of this entity (i.e., related entities pk fields) */ - private JDBCCMPFieldBridge[] foreignKeyFields; + private List foreignKeyFields; /** +* JDBCType for the foreign key fields. Basically, this is an ordered +* merge of the JDBCType of the foreign key field. +*/ + private JDBCType jdbcType; + + /** * The related entity's container. */ private EntityContainer relatedContainer; @@ -235,31 +247,32 @@ if(metadata.getRelationMetaData().isTableMappingStyle()) { // initialize relation table key fields Collection tableKeys = metadata.getTableKeyFields(); - Set keys = new HashSet(); + tableKeyFields = new ArrayList(tableKeys.size()); for(Iterator i=tableKeys.iterator(); i.hasNext(); ) { JDBCCMPFieldMetaData cmpFieldMetaData = (JDBCCMPFieldMetaData)i.next(); -keys.add(new JDBCCMP2xFieldBridge(manager, cmpFieldMetaData)); +tableKeyFields.add( + new JDBCCMP2xFieldBridge(manager, cmpFieldMetaData)); } - tableKeyFields = new JDBCCMPFieldBridge[tableKeys.size()]; - tableKeyFields = (JDBCCMPFieldBridge[])keys.toArray(tableKeyFields); + tableKeyFields = Collections.unmodifiableList(tableKeyFields); } else { // initialize foreign key fields Collection foreignKeys = metadata.getForeignKeyFields(); - Set keys = new HashSet(); + foreignKeyFields = new ArrayList(foreignKeys.size()); for(Iterator i=foreignKeys.iterator(); i.hasNext(); ) { JDBCCMPFieldMetaData cmpFieldMetaData = (JDBCCMPFieldMetaData)i.next(); -keys.add(new JDBCCMP2xFieldBridge( +foreignKeyFields.add(new JDBCCMP2xFieldBridge( manager, cmpFieldMetaData, manager.getJDBCTypeFactory().getJDBCType(
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCEntityMetaData.java
User: dsundstrom Date: 02/01/15 13:12:53 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCEntityMetaData.java Log: Added support for new read ahead meta data. Added named load groups. Changed lazy load groups to just a list of load group names. Changed eager load group to just a name of a group. Revision ChangesPath 1.14 +192 -120 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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JDBCEntityMetaData.java 2001/12/05 05:07:17 1.13 +++ JDBCEntityMetaData.java 2002/01/15 21:12:53 1.14 @@ -11,9 +11,11 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import org.jboss.deployment.DeploymentException; import org.jboss.metadata.EntityMetaData; @@ -27,7 +29,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.13 $ + * @version $Revision: 1.14 $ */ public final class JDBCEntityMetaData { /** @@ -134,13 +136,19 @@ /** * Map of the cmp fields of this entity by field name. */ - private final Map cmpFields = new HashMap(); + private final Map cmpFieldsByName = new HashMap(); + private final List cmpFields = new ArrayList(); /** +* A map of all the load groups by name. +*/ + private final Map loadGroups = new HashMap(); + + /** * The fields which should always be loaded when an entity of this type * is loaded. */ - private final List eagerLoadFields = new ArrayList(); + private final String eagerLoadGroup; /** * A list of groups (also lists) of the fields that should be lazy @@ -164,6 +172,12 @@ private final JDBCReadAheadMetaData readAhead; /** +* The maximum number of read ahead lists that can be tracked for this +* entity. +*/ + private final int listCacheMax; + + /** * Constructs jdbc entity meta data defined in the jdbcApplication and * with the data from the entity meta data which is loaded from the * ejb-jar.xml file. @@ -182,6 +196,7 @@ this.jdbcApplication = jdbcApplication; entityName = entity.getEjbName(); abstractSchemaName = entity.getAbstractSchemaName(); + listCacheMax = 1000; try { entityClass = getClassLoader().loadClass(entity.getEjbClass()); @@ -249,16 +264,20 @@ // build the metadata for the cmp fields now in case there is // no jbosscmp-jdbc.xml + List nonPkFieldNames = new ArrayList(); for(Iterator i = entity.getCMPFields(); i.hasNext(); ) { String cmpFieldName = (String)i.next(); - JDBCCMPFieldMetaData cmpField = + JDBCCMPFieldMetaData cmpField = new JDBCCMPFieldMetaData(this, cmpFieldName); - cmpFields.put(cmpFieldName, cmpField); + cmpFields.add(cmpField); + cmpFieldsByName.put(cmpFieldName, cmpField); + if(!cmpField.isPrimaryKeyMember()) { +nonPkFieldNames.add(cmpFieldName); + } } - // set eager load fields to all cmp fields in case there is - // no jbosscmp-jdbc.xml - eagerLoadFields.addAll(cmpFields.values()); + // set eager load fields to all group. + eagerLoadGroup = *; // Create no lazy load groups. By default every thing is eager loaded. // build the metadata for the queries now in case there is no @@ -269,11 +288,10 @@ queriesIterator.hasNext();) { QueryMetaData queryData = (QueryMetaData)queriesIterator.next(); - Method[] methods = queryFactory.getQueryMethods(queryData); - for(int i=0; imethods.length; i++) { -queries.put(methods[i], - queryFactory.createJDBCQueryMetaData(queryData, methods[i])); - } + Map newQueries = queryFactory.createJDBCQueryMetaData(queryData); + + // overrides defaults added above + queries.putAll(newQueries); } // Create no relationship roles for this entity, will be added @@ -411,8 +429,27 @@ primaryKeyConstraint = defaultValues.hasPrimaryKeyConstraint(); } + // list-cache-max + String listCacheMaxStr = +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationshipRoleMetaData.java
User: dsundstrom Date: 02/01/15 13:16:24 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCRelationshipRoleMetaData.java Log: Added support for read ahead metadata. Changed auto generated column name to be just cmr field name unless there are more then one key column. In that case it uses the old cmrFieldName_keyFieldName, format. Revision ChangesPath 1.12 +67 -18 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JDBCRelationshipRoleMetaData.java 2001/12/12 19:49:42 1.11 +++ JDBCRelationshipRoleMetaData.java 2002/01/15 21:16:24 1.12 @@ -8,6 +8,7 @@ import java.util.Collection; import java.util.Collections; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -22,7 +23,7 @@ * the ejb-jar.xml file's ejb-relation elements. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public final class JDBCRelationshipRoleMetaData { /** @@ -65,6 +66,11 @@ */ private final String cmrFieldType; + /** +* Type of the cmr field (i.e., collection or set) +*/ + private final JDBCReadAheadMetaData readAhead; + private final Map tableKeyFields = new HashMap(); private final Map foreignKeyFields = new HashMap(); @@ -81,6 +87,7 @@ multiplicityOne = relationshipRole.isMultiplicityOne(); cascadeDelete = relationshipRole.isCascadeDelete(); foreignKeyConstraint = false; + readAhead = null; String tempCmrFieldName = relationshipRole.getCMRFieldName(); if(tempCmrFieldName == null) { @@ -134,6 +141,16 @@ foreignKeyConstraint = defaultValues.hasForeignKeyConstraint(); } + // read-ahead + Element readAheadElement = +MetaData.getOptionalChild(element, read-ahead); + if(readAheadElement != null) { + readAhead = new JDBCReadAheadMetaData( + readAheadElement, entity.getReadAhead()); + } else { + readAhead = entity.getReadAhead(); + } + if(relationMetaData.isTableMappingStyle()) { if(defaults.equals(element.getTagName())) { loadTableKeyFields(); @@ -244,9 +261,16 @@ */ public JDBCRelationshipRoleMetaData getRelatedRole() { return relationMetaData.getOtherRelationshipRole(this); - } + } /** +* Gets the read ahead meta data +*/ + public JDBCReadAheadMetaData getReadAhead() { + return readAhead; + } + + /** * Gets the foreign key fields of this role. The foreign key fields hold the * primary keys of the related entity. A relationship role has foreign key * fields if the relation mapping style is foreign key and the other side of @@ -279,20 +303,33 @@ for: + relationshipRoleName); } + ArrayList pkFields = new ArrayList(); + for(Iterator i = relatedEntity.getCMPFields().iterator(); i.hasNext();) { JDBCCMPFieldMetaData cmpField = (JDBCCMPFieldMetaData)i.next(); if(cmpField.isPrimaryKeyMember()) { -cmpField = new JDBCCMPFieldMetaData( - entity, - cmpField, - getCMRFieldName() + _ + cmpField.getFieldName(), - false, - relationMetaData.isReadOnly(), - relationMetaData.getReadTimeOut()); -foreignKeyFields.put(cmpField.getFieldName(), cmpField); +pkFields.add(cmpField); } } + + for(Iterator i = pkFields.iterator(); i.hasNext(); ) { + JDBCCMPFieldMetaData cmpField = (JDBCCMPFieldMetaData)i.next(); + + String columnName = getCMRFieldName(); + if(pkFields.size() 1) { +columnName += _ + cmpField.getFieldName(); + } + + cmpField = new JDBCCMPFieldMetaData( + entity, + cmpField, + columnName, + false, + relationMetaData.isReadOnly(), + relationMetaData.getReadTimeOut()); + foreignKeyFields.put(cmpField.getFieldName(), cmpField); + } } /** @@ -349,20 +386,32 @@ * this entity. */ private void loadTableKeyFields() { + ArrayList pkFields = new ArrayList();
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCReadAheadMetaData.java
User: dsundstrom Date: 02/01/15 13:19:43 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCReadAheadMetaData.java Log: Updated to new readahead format, which supports on-find. Revision ChangesPath 1.5 +77 -94 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCReadAheadMetaData.java Index: JDBCReadAheadMetaData.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCReadAheadMetaData.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JDBCReadAheadMetaData.java2001/11/26 03:12:27 1.4 +++ JDBCReadAheadMetaData.java2002/01/15 21:19:43 1.5 @@ -19,7 +19,7 @@ * It loads its data from standardjbosscmp-jdbc.xml and jbosscmp-jdbc.xml * * @author a href=mailto:[EMAIL PROTECTED];Oleg Nitz/a - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public final class JDBCReadAheadMetaData { @@ -31,151 +31,131 @@ /** * Don't read ahead. */ - public static final byte NONE = 0; + private static final byte NONE = 0; /** -* Read ahead when some entity is being loaded (lazily, good for all queries). +* Read ahead when some entity is being loaded (lazily, good for +* all queries). */ - public static final byte ON_LOAD = 1; + private static final byte ON_LOAD = 1; /** -* Read ahead during find (not lazily, the best for queries with small result set). +* Read ahead during find (not lazily, the best for queries with +* small result set). */ - public static final byte ON_FIND = 2; + private static final byte ON_FIND = 2; - private static final List STRATEGIES = Arrays.asList(new String[] {none, on-load, on-find}); + private static final List STRATEGIES = + Arrays.asList(new String[] {none, on-load, on-find}); - public static final byte DEFAULT_STRATEGY = ON_LOAD; - - public static final int DEFAULT_LIMIT = 255; - - public static final int DEFAULT_CACHE_SIZE = 100; - /** -* The strategy of reading ahead, one of {@link #NONE}, {@link #ON_LOAD}, {@link #ON_FIND}. +* The strategy of reading ahead, one of +* {@link #NONE}, {@link #ON_LOAD}, {@link #ON_FIND}. */ private final byte strategy; /** -* The limit of the read ahead buffer +* The page size of the read ahead buffer */ - private final int limit; + private final int pageSize; /** -* The size of the cache of queries +* The name of the load group to eager load. */ - private final int cacheSize; + private final String eagerLoadGroup; /** * Constructs default read ahead meta data: no read ahead. */ private JDBCReadAheadMetaData() { - strategy = DEFAULT_STRATEGY; - limit = DEFAULT_LIMIT; - cacheSize = DEFAULT_CACHE_SIZE; + strategy = ON_LOAD; + pageSize = 255; + eagerLoadGroup = *; } /** -* Constructs read ahead meta data with the data contained in the cmp-field xml -* element from a jbosscmp-jdbc xml file. Optional values of the xml element that -* are not present are instead loaded from the defalutValues parameter. +* Constructs read ahead meta data with the data contained in the read-ahead +* xml element from a jbosscmp-jdbc xml file. Optional values of the xml +* element that are not present are instead loaded from the defalutValues +* parameter. * -* @param element the xml Element which contains the metadata about this field -* @param defaultValues the JDBCCMPFieldMetaData which contains the values -* for optional elements of the element -* @throws DeploymentException if data in the entity is inconsistent with field type -*/ - public JDBCReadAheadMetaData(Element element) throws DeploymentException { - // true/false content is JAWS style, we support it. - String trueOrFalse = MetaData.getElementContent(element); - if (trueOrFalse.equals(true)) { - strategy = DEFAULT_STRATEGY; - limit = DEFAULT_LIMIT; - cacheSize = DEFAULT_CACHE_SIZE; - } else if (trueOrFalse.equals(false)) { - strategy = NONE; - limit = DEFAULT_LIMIT; - cacheSize = DEFAULT_CACHE_SIZE; - } else { - // This is new style: strategy and limit sub-elements +* @param element the xml Element which contains the read-ahead metadata +* @throws DeploymentException if the xml element is invalid +*/ + public JDBCReadAheadMetaData( + Element element, + JDBCReadAheadMetaData defaultValue) throws DeploymentException { + + // Strategy +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCQueryMetaDataFactory.java
User: dsundstrom Date: 02/01/15 13:18:42 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata JDBCQueryMetaDataFactory.java Log: Cleaned-up public interface. Now there is just a create it function, instead of a set of functions that must be called in a special order. Revision ChangesPath 1.9 +65 -15 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JDBCQueryMetaDataFactory.java 2001/11/26 03:12:27 1.8 +++ JDBCQueryMetaDataFactory.java 2002/01/15 21:18:41 1.9 @@ -9,7 +9,9 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import org.w3c.dom.Element; @@ -22,7 +24,7 @@ * on the query specifiection type. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ public class JDBCQueryMetaDataFactory { private JDBCEntityMetaData entity; @@ -31,14 +33,54 @@ this.entity = entity; } - public JDBCQueryMetaData createJDBCQueryMetaData( - QueryMetaData queryMetaData, - Method method) throws DeploymentException { + public Map createJDBCQueryMetaData(QueryMetaData queryData) + throws DeploymentException { - return new JDBCQlQueryMetaData(queryMetaData, method); + Method[] methods = getQueryMethods(queryData); + Map queries = new HashMap(methods.length); + for(int i=0; imethods.length; i++) { + queries.put(methods[i], + new JDBCQlQueryMetaData(queryData, methods[i])); + } + return queries; } + + public Map createJDBCQueryMetaData( + Element queryElement, + Map defaultValues, + JDBCReadAheadMetaData readAhead) throws DeploymentException { + + // get the query methods + Method[] methods = getQueryMethods(queryElement); + + // read-ahead + Element readAheadElement = +MetaData.getOptionalChild(queryElement, read-ahead); + if(readAheadElement != null) { + readAhead = new JDBCReadAheadMetaData(readAheadElement, readAhead); + } - public JDBCQueryMetaData createJDBCQueryMetaData( + Map queries = new HashMap(methods.length); + for(int i=0; imethods.length; i++) { + JDBCQueryMetaData defaultValue = + (JDBCQueryMetaData)defaultValues.get(methods[i]); + + if(defaultValue == null) { +throw new DeploymentException(Unknown query method : +methods[i]); + } + + JDBCQueryMetaData jdbcQueryData = createJDBCQueryMetaData( + defaultValue, + queryElement, + methods[i], + readAhead); + + queries.put(methods[i], jdbcQueryData); + } + return queries; + } + + private JDBCQueryMetaData createJDBCQueryMetaData( JDBCQueryMetaData jdbcQueryMetaData, Element queryElement, Method method, @@ -75,7 +117,7 @@ Error in query spedification for method + method.getName()); } - public Method[] getQueryMethods(Element queryElement) + private Method[] getQueryMethods(Element queryElement) throws DeploymentException { // query-method sub-element @@ -100,14 +142,14 @@ return getQueryMethods(methodName, parameters); } - public Method[] getQueryMethods(QueryMetaData queryData) + private Method[] getQueryMethods(QueryMetaData queryData) throws DeploymentException { String methodName = queryData.getMethodName(); Class[] parameters = convertToJavaClasses(queryData.getMethodParams()); return getQueryMethods(methodName, parameters); } - public Method[] getQueryMethods( + private Method[] getQueryMethods( String methodName, Class parameters[]) throws DeploymentException { @@ -115,20 +157,28 @@ ArrayList methods = new ArrayList(2); if(methodName.startsWith(ejbSelect)) { // bean method - methods.add(getQueryMethod( - methodName, - parameters, - entity.getEntityClass())); + Method method = getQueryMethod( + methodName, parameters, entity.getEntityClass()); + if(method != null) { +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc ReadAheadCache.java
User: dsundstrom Date: 02/01/15 13:28:49 Added: src/main/org/jboss/ejb/plugins/cmp/jdbc ReadAheadCache.java Log: New readahead cahce. This cache uses the generic data containers in JDBCStoreManager, and supports readahead lists and preload data. Revision ChangesPath 1.1 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java Index: ReadAheadCache.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.lang.ref.SoftReference; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; import org.jboss.logging.Logger; import org.jboss.util.FinderResults; import org.jboss.util.LRUCachePolicy; /** * ReadAheadCache stores all of the data readahead for an entity. * Data is stored in the JDBCStoreManager entity tx data map on a per entity * basis. The read ahead data for each entity is stored with a soft reference. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a * @version $Revision: 1.1 $ */ public class ReadAheadCache { /** * To simplify null values handling in the preloaded data pool we use * this value instead of 'null' */ private static final Object NULL_VALUE = new Object(); private final JDBCStoreManager manager; private final Logger log; private Map listMap; private ListCache listCache; public ReadAheadCache(JDBCStoreManager manager) { this.manager = manager; // Create the Log log = Logger.getLogger( this.getClass().getName() + . + manager.getMetaData().getName()); } public void create() { // Create the list map listMap = new HashMap(); // Create the list cache int listCacheMax = manager.getEntityBridge().getListCacheMax(); listCache = new ListCache(listCacheMax); listCache.create(); } public void start() { listCache.start(); } public void stop() { listMap.clear(); listCache.stop(); } public void destroy() { listCache.destroy(); listCache = null; listMap = null; } public synchronized void addFinderResult(FinderResults finderResults) { if(finderResults.size() = 1) { // only cache results with more then one entry return; } if(!(finderResults.getAllKeys() instanceof List)) { log.warn(FinderResults does not contain a List. Read ahead will be + disabled for this query); return; } // add the finder to the LRU list listCache.add(finderResults); // // Create a map between the entity prumary keys and the list. // The primary key will point to the last list added that contained the // primary key. // HashSet dereferencedResults = new HashSet(); Iterator iter = finderResults.iterator(); for(int i=0; iter.hasNext(); i++) { Object primaryKey = iter.next(); // Keep track of the resutls that have been dereferenced. Later we // all results from the list cache that are no longer referenced. EntityMapEntry oldInfo = (EntityMapEntry)listMap.put( primaryKey, new EntityMapEntry(i, finderResults)); if(oldInfo != null) { dereferencedResults.add(oldInfo.finderResults); } } // // Now we remove all lists from the list cache that are no longer // referenced in the list map. // // if we don't have any dereferenced results at this point we are done if(dereferencedResults.isEmpty()) { return; } // remove all lists from the dereferenced set that are still referenced // in the listMap iter = listMap.values().iterator(); while(iter.hasNext()) { EntityMapEntry entry = (EntityMapEntry)iter.next(); dereferencedResults.remove(entry.finderResults); } // if we don't have any dereferenced results at this point we are done if(dereferencedResults.isEmpty()) { return; } // remove all results from the cache that are no longer referenced iter =
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc SQLUtil.java
User: dsundstrom Date: 02/01/15 13:29:50 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc SQLUtil.java Log: Converted field arrays to Lists for easier handling. Revision ChangesPath 1.5 +184 -90 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SQLUtil.java 2001/09/01 22:03:15 1.4 +++ SQLUtil.java 2002/01/15 21:29:50 1.5 @@ -7,44 +7,54 @@ package org.jboss.ejb.plugins.cmp.jdbc; -import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; + /** * SQLUtil helps with building sql statements. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public class SQLUtil { // === // Create Table Columns Clause - //columnName0 sqlType0 [, columnName1 sqlType0 [, columnName2 sqlType0 [...]]] + //columnName0 sqlType0 + //[, columnName1 sqlType0 + //[, columnName2 sqlType0 [...]]] // === - - /** - * Returns columnName0 [, columnName1 [AND columnName2 [...]]] - */ - public static String getCreateTableColumnsClause(JDBCCMPFieldBridge[] fields) { + public static String getCreateTableColumnsClause(List fields) { StringBuffer buf = new StringBuffer(); - for(int i=0; ifields.length; i++) { - if(i!=0) { + + List types = getJDBCTypes(fields); + for(Iterator iter = types.iterator(); iter.hasNext();) { + JDBCType type = (JDBCType)iter.next(); + buf.append(getCreateTableColumnsClause(type)); + if(iter.hasNext()) { buf.append(, ); } - buf.append(getCreateTableColumnsClause(fields[i].getJDBCType())); } return buf.toString(); } - + /** - * Returns columnName0 sqlType0 [, columnName1 sqlType0 [, columnName2 sqlType0 [...]]] - */ - public static String getCreateTableColumnsClause(JDBCCMPFieldBridge field) { +* Returns columnName0 sqlType0 +*[, columnName1 sqlType0 +*[, columnName2 sqlType0 [...]]] +*/ + public static String getCreateTableColumnsClause(JDBCFieldBridge field) { return getCreateTableColumnsClause(field.getJDBCType()); } /** - * Returns columnName0 sqlType0 [, columnName1 sqlType0 [, columnName2 sqlType0 [...]]] - */ +* Returns columnName0 sqlType0 +*[, columnName1 sqlType0 +*[, columnName2 sqlType0 [...]]] +*/ public static String getCreateTableColumnsClause(JDBCType type) { String[] columnNames = type.getColumnNames(); String[] sqlTypes = type.getSQLTypes(); @@ -65,43 +75,52 @@ // === /** - * Returns columnName0 [, columnName1 [AND columnName2 [...]]] - */ - public static String getColumnNamesClause(JDBCCMPFieldBridge[] fields) { +* Returns columnName0 [, columnName1 [AND columnName2 [...]]] +*/ + public static String getColumnNamesClause(List fields) { return getColumnNamesClause(fields, ); } /** - * Returns columnName0 [, columnName1 [AND columnName2 [...]]] - */ - public static String getColumnNamesClause(JDBCCMPFieldBridge[] fields, String identifier) { +* Returns columnName0 [, columnName1 [AND columnName2 [...]]] +*/ + public static String getColumnNamesClause(List fields, String identifier) { StringBuffer buf = new StringBuffer(); - for(int i=0; ifields.length; i++) { - if(i!=0) { + + List types = getJDBCTypes(fields); + for(Iterator iter = types.iterator(); iter.hasNext();) { + JDBCType type = (JDBCType)iter.next(); + buf.append(getColumnNamesClause(type, identifier)); + if(iter.hasNext()) { buf.append(, ); } - buf.append(getColumnNamesClause(fields[i].getJDBCType(), identifier)); } return buf.toString(); } - + /** - * Returns columnName0 [, columnName1 [, columnName2 [...]]] - */ - public static String getColumnNamesClause(JDBCCMPFieldBridge field) { +* Returns columnName0 [, columnName1 [, columnName2 [...]]] +
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc QueryParameter.java
User: dsundstrom Date: 02/01/15 13:36:58 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc QueryParameter.java Log: Changed field arrays to lists for easier handling. Revision ChangesPath 1.4 +15 -10 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/QueryParameter.java Index: QueryParameter.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/QueryParameter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- QueryParameter.java 2001/11/29 20:40:05 1.3 +++ QueryParameter.java 2002/01/15 21:36:58 1.4 @@ -3,6 +3,7 @@ import java.lang.reflect.Method; import java.sql.PreparedStatement; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import javax.ejb.EJBException; @@ -62,9 +63,11 @@ List parameters = new ArrayList(); - JDBCCMPFieldBridge[] pkFields = entity.getJDBCPrimaryKeyFields(); - for(int i=0; ipkFields.length; i++) { - JDBCType type = pkFields[i].getJDBCType(); + List pkFields = entity.getPrimaryKeyFields(); + for(Iterator iter = pkFields.iterator(); iter.hasNext();) { + JDBCCMPFieldBridge pkField = (JDBCCMPFieldBridge)iter.next(); + + JDBCType type = pkField.getJDBCType(); if(type instanceof JDBCTypeComplex) { JDBCTypeComplexProperty[] props = ((JDBCTypeComplex)type).getProperties(); @@ -72,7 +75,7 @@ QueryParameter param = new QueryParameter( argNum, false, -pkFields[i], +pkField, props[j], props[j].getJDBCType()); parameters.add(param); @@ -81,7 +84,7 @@ QueryParameter param = new QueryParameter( argNum, false, - pkFields[i], + pkField, null, type.getJDBCTypes()[0]); parameters.add(param); @@ -95,10 +98,12 @@ JDBCEntityBridge entity) { List parameters = new ArrayList(); + + List pkFields = entity.getPrimaryKeyFields(); + for(Iterator iter = pkFields.iterator(); iter.hasNext();) { + JDBCCMPFieldBridge pkField = (JDBCCMPFieldBridge)iter.next(); - JDBCCMPFieldBridge[] pkFields = entity.getJDBCPrimaryKeyFields(); - for(int i=0; ipkFields.length; i++) { - JDBCType type = pkFields[i].getJDBCType(); + JDBCType type = pkField.getJDBCType(); if(type instanceof JDBCTypeComplex) { JDBCTypeComplexProperty[] props = ((JDBCTypeComplex)type).getProperties(); @@ -106,7 +111,7 @@ QueryParameter param = new QueryParameter( argNum, true, -pkFields[i], +pkField, props[j], props[j].getJDBCType()); parameters.add(param); @@ -115,7 +120,7 @@ QueryParameter param = new QueryParameter( argNum, true, - pkFields[i], + pkField, null, type.getJDBCTypes()[0]); parameters.add(param); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindAllQuery.java
User: dsundstrom Date: 02/01/15 13:45:17 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindAllQuery.java Log: Added support for read ahead on find. Revision ChangesPath 1.2 +23 -4 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindAllQuery.java Index: JDBCFindAllQuery.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindAllQuery.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCFindAllQuery.java 2001/11/28 11:32:54 1.1 +++ JDBCFindAllQuery.java 2002/01/15 21:45:17 1.2 @@ -7,7 +7,12 @@ package org.jboss.ejb.plugins.cmp.jdbc; +import java.util.ArrayList; +import java.util.List; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; + /** * JDBCFindAllQuery automatic finder used in CMP 1.x. * @@ -16,17 +21,31 @@ * @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.1 $ + * @version $Revision: 1.2 $ */ public class JDBCFindAllQuery extends JDBCAbstractQueryCommand { public JDBCFindAllQuery(JDBCStoreManager manager, JDBCQueryMetaData q) { super(manager, q); + + JDBCEntityBridge entity = manager.getEntityBridge(); + + // set the preload fields + JDBCReadAheadMetaData readAhead = q.getReadAhead(); + if(!readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + setPreloadFields(entity.getLoadGroup(eagerLoadGroupName)); + } + + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(entity.getPrimaryKeyFields()); + loadFields.addAll(getPreloadFields()); + // generate the sql StringBuffer sql = new StringBuffer(); - sql.append(SELECT ).append(SQLUtil.getColumnNamesClause( - manager.getEntityBridge().getJDBCPrimaryKeyFields())); - sql.append( FROM ).append(manager.getEntityBridge().getTableName()); + sql.append(SELECT ).append(SQLUtil.getColumnNamesClause(loadFields)); + sql.append( FROM ).append(entity.getTableName()); setSQL(sql.toString()); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCDeclaredSQLQuery.java
User: dsundstrom Date: 02/01/15 13:47:10 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCDeclaredSQLQuery.java Log: Added support for read-ahead on-find. Revision ChangesPath 1.2 +27 -8 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeclaredSQLQuery.java Index: JDBCDeclaredSQLQuery.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeclaredSQLQuery.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCDeclaredSQLQuery.java 2001/11/28 11:32:54 1.1 +++ JDBCDeclaredSQLQuery.java 2002/01/15 21:47:10 1.2 @@ -7,6 +7,9 @@ package org.jboss.ejb.plugins.cmp.jdbc; +import java.util.ArrayList; +import java.util.List; + import org.jboss.deployment.DeploymentException; import org.jboss.ejb.Container; @@ -16,6 +19,7 @@ import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCDeclaredQueryMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; /** * This class generates a query based on the delcared-sql xml specification. @@ -27,7 +31,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a * @author a href=mailto:[EMAIL PROTECTED];Michel de Groot/a * @author a href=[EMAIL PROTECTED]danch (Dan Christopherson/a - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class JDBCDeclaredSQLQuery extends JDBCAbstractQueryCommand { @@ -44,10 +48,18 @@ metadata = (JDBCDeclaredQueryMetaData) q; + // set the select object (either selectEntity or selectField) initSelectObject(manager); - String sql = buildSQL(); + // set the preload fields + JDBCReadAheadMetaData readAhead = metadata.getReadAhead(); + if(getSelectEntity() != null !readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + setPreloadFields(getSelectEntity().getLoadGroup(eagerLoadGroupName)); + } + // set the sql and parameters + String sql = buildSQL(); setSQL(parseParameters(sql)); } @@ -120,18 +132,25 @@ String from = metadata.getFrom(); if(getSelectField() == null) { - JDBCEntityBridge selectEntity = getSelectEntity(); - String table = selectEntity.getMetaData().getTableName(); + + // we are selecting a full entity + String table = getSelectEntity().getMetaData().getTableName(); + + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(getSelectEntity().getPrimaryKeyFields()); + loadFields.addAll(getPreloadFields()); + if(from != null from.trim().length()0) { -sql.append(SQLUtil.getColumnNamesClause( - selectEntity.getJDBCPrimaryKeyFields(), table)); +sql.append(SQLUtil.getColumnNamesClause(loadFields, table)); sql.append( FROM ).append(table).append( ).append(from); } else { -sql.append(SQLUtil.getColumnNamesClause( - selectEntity.getJDBCPrimaryKeyFields())); +sql.append(SQLUtil.getColumnNamesClause(loadFields)); sql.append( FROM ).append(table); } } else { + + // we are just selecting one field JDBCCMPFieldBridge selectField = getSelectField(); String table = selectField.getMetaData().getEntity().getTableName(); if(from != null from.trim().length()0) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCCommandFactory.java
User: dsundstrom Date: 02/01/15 13:48:45 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCCommandFactory.java Log: Droped constructors for removed commands. Revision ChangesPath 1.14 +2 -15 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCCommandFactory.java Index: JDBCCommandFactory.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCCommandFactory.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JDBCCommandFactory.java 2001/12/04 06:30:53 1.13 +++ JDBCCommandFactory.java 2002/01/15 21:48:45 1.14 @@ -17,7 +17,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a * @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a * @author a href=[EMAIL PROTECTED]danch (Dan Christopherson/a - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ public class JDBCCommandFactory { private JDBCStoreManager manager; @@ -26,11 +26,6 @@ this.manager = manager; } - // Additional Command creation - public JDBCLoadFieldCommand createLoadFieldCommand() { - return new JDBCLoadFieldCommand(manager); - } - public JDBCQueryCommand createFindByPrimaryKeyQuery(JDBCQueryMetaData q) { return new JDBCFindByPrimaryKeyQuery(manager, q); } @@ -54,10 +49,6 @@ return new JDBCFindByQuery(manager, q); } - public JDBCFindByForeignKeyCommand createFindByForeignKeyCommand() { - return new JDBCFindByForeignKeyCommand(manager); - } - public JDBCLoadRelationCommand createLoadRelationCommand() { return new JDBCLoadRelationCommand(manager); } @@ -70,10 +61,6 @@ return new JDBCInsertRelationsCommand(manager); } - public JDBCReadAheadCommand createReadAheadCommand() { - return new JDBCReadAheadCommand(manager); - } - // lifecycle commands public JDBCInitCommand createInitCommand() { @@ -112,7 +99,7 @@ return new JDBCFindEntitiesCommand(manager); } - public JDBCCreateEntityCommand createCreateEntityCommand() { + public JDBCCreateEntityCommand createCreateEntityCommand() { return new JDBCCreateEntityCommand(manager); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] [AUTOMATED] JBoss compilation failed
= ==THIS IS AN AUTOMATED EMAIL - SEE http://www.lubega.com FOR DETAILS= = HERE ARE THE LAST 50 LINES OF THE LOG FILE relatedManager.getReadAheadCache(); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:262: cannot resolve symbol symbol : method removeEntityTxData (org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.PreloadKey) location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager manager.removeEntityTxData(new PreloadKey(ctx.getId())); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:299: cannot resolve symbol symbol : method removeEntityTxData (org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.PreloadKey) location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager manager.removeEntityTxData(new PreloadKey(primaryKey)); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:341: cannot resolve symbol symbol : method getEntityTxData (org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.PreloadKey) location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager SoftReference ref = (SoftReference)manager.getEntityTxData(preloadKey); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:360: cannot resolve symbol symbol : method removeEntityTxData (org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.PreloadKey) location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager manager.removeEntityTxData(preloadKey); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:375: cannot resolve symbol symbol : method putEntityTxData (org.jboss.ejb.plugins.cmp.jdbc.ReadAheadCache.PreloadKey,java.lang.ref.SoftReference) location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager manager.putEntityTxData(preloadKey, ref); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCReadAheadInterceptor.java:79: cannot resolve symbol symbol : method getLimit () location: class org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData to = Math.min(results.size(), key.getIndex() + storeManager.getMetaData().getReadAhead().getLimit()); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeclaredSQLQuery.java:127: cannot resolve symbol symbol : method getJDBCPrimaryKeyFields () location: class org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge selectEntity.getJDBCPrimaryKeyFields(), table)); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCDeclaredSQLQuery.java:131: cannot resolve symbol symbol : method getJDBCPrimaryKeyFields () location: class org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge selectEntity.getJDBCPrimaryKeyFields())); ^ 78 errors 4 warnings BUILD FAILED /disk/orig/home/lubega/jbossro/jboss-all/server/build.xml:385: Compile failed, messages should have been provided. Total time: 1 minute 4 seconds ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCAbstractQueryCommand.java
User: dsundstrom Date: 02/01/15 13:55:34 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCAbstractQueryCommand.java Log: Added support for read ahead on find. Revision ChangesPath 1.6 +47 -23 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java Index: JDBCAbstractQueryCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- JDBCAbstractQueryCommand.java 2002/01/05 12:08:50 1.5 +++ JDBCAbstractQueryCommand.java 2002/01/15 21:55:33 1.6 @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; @@ -29,6 +30,7 @@ import org.jboss.ejb.EntityEnterpriseContext; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData; import org.jboss.logging.Logger; import org.jboss.util.FinderResults; @@ -42,7 +44,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.5 $ + * @version $Revision: 1.6 $ */ public abstract class JDBCAbstractQueryCommand implements JDBCQueryCommand { private JDBCStoreManager manager; @@ -51,8 +53,9 @@ private JDBCEntityBridge selectEntity; private JDBCCMPFieldBridge selectField; + private List preloadFields = new ArrayList(0); private String sql; - private List parameters = new ArrayList(); + private List parameters = new ArrayList(0); public JDBCAbstractQueryCommand( JDBCStoreManager manager, JDBCQueryMetaData q) { @@ -74,7 +77,12 @@ Object[] args, EntityEnterpriseContext ctx) throws FinderException { - boolean debug = log.isDebugEnabled(); + JDBCStoreManager selectManager = null; + ReadAheadCache selectReadAheadCache = null; + if(selectEntity != null) { + selectManager = selectEntity.getManager(); + selectReadAheadCache = selectManager.getReadAheadCache(); + } Collection results = new ArrayList(); @@ -100,12 +108,26 @@ // load the results if(selectEntity != null) { -// load the pks -Object[] pkRef = new Object[1]; +Object[] ref = new Object[1]; + while(rs.next()) { - pkRef[0] = null; - selectEntity.loadPrimaryKeyResults(rs, 1, pkRef); - results.add(pkRef[0]); + int index = 1; + ref[0] = null; + + // get the pk + index = selectEntity.loadPrimaryKeyResults(rs, index, ref); + Object pk = ref[0]; + results.add(ref[0]); + + // read the preload fields + for(Iterator iter=preloadFields.iterator(); iter.hasNext();) { + JDBCFieldBridge field = (JDBCFieldBridge)iter.next(); + ref[0] = null; + + // read the value and store it in the readahead cache + index = field.loadArgumentResults(rs, index, ref); + selectReadAheadCache.addPreloadData(pk, field, ref[0]); + } } } else { // load the field @@ -117,8 +139,7 @@ } } } catch(Exception e) { - if (debug) -log.debug(e); + log.debug(Find failed, e); throw new FinderException(Find failed: + e); } finally { JDBCUtil.safeClose(ps); @@ -131,15 +152,12 @@ } // Convert the pk collection into finder results - boolean readAheadOnLoad = queryMetaData.getReadAhead().isOnLoadUsed(); FinderResults finderResults = new FinderResults( -results, null, null, null, readAheadOnLoad); +results, queryMetaData.getReadAhead(), null, null); - // If read ahead is on, store the finder results for optimized loading. - if(readAheadOnLoad) { - // add to the cache - manager.getReadAheadCache().insert( - new Long(finderResults.getListId()), finderResults); + // add to the cache + if(!queryMetaData.getReadAhead().isNone()) { + selectReadAheadCache.addFinderResult(finderResults); }
RE: [JBoss-dev] Cover idea for upcoming JBoss book
I don't think girls are impressed by the architecture bits... perhaps the goat... How about a studly alien in jboss suit with hot anime chicks in the background looking all saucy-like. =) --jason -Original Message- From: [EMAIL PROTECTED] [mailto:jboss- [EMAIL PROTECTED]] On Behalf Of marc fleury Sent: Tuesday, January 15, 2002 1:36 PM To: John Woo; [EMAIL PROTECTED] Subject: RE: [JBoss-dev] Cover idea for upcoming JBoss book I really want to write Touching your wee-wee with shitty pompous architecture and design And an article for those buffon at Dr Dobbs The false intellectualism of object oriented software programming and would obliterate Grow a fancy goatee, pretend you can architect, and impress girls Make a fortune as an impostor in 21 days The monkey farting around is a really good cover marcf I love the wall-paper pattern - someone at Dresdner bank UK- |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED]]On Behalf Of John |Woo |Sent: Tuesday, January 15, 2002 10:09 AM |To: [EMAIL PROTECTED] |Subject: [JBoss-dev] Cover idea for upcoming JBoss book | | |Sorry to hear you server crash. Maybe this funny book |cover idea make you feel better: | |http://photos.yahoo.com/bc/jbwoo/vwp2?.tok=bclLHEPBgMgiDocV.di |r=/shared.dnm=jbbc.gif.gif.src=ph | | |__ |Do You Yahoo!? |Send FREE video emails in Yahoo! Mail! |http://promo.yahoo.com/videomail/ | |___ |Jboss-development mailing list |[EMAIL PROTECTED] |https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCReadAheadCommand.java
User: dsundstrom Date: 02/01/15 14:11:16 Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCReadAheadCommand.java Log: Merged into JDBCLoadEntityCommand. ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByForeignKeyCommand.java
User: dsundstrom Date: 02/01/15 14:10:08 Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByForeignKeyCommand.java Log: Merged into JDBCLoadRelationCommand. ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadFieldCommand.java
User: dsundstrom Date: 02/01/15 14:10:49 Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadFieldCommand.java Log: Merged into JDBCLoadEntityCommand. ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCCreateEntityCommand.java
User: dsundstrom Date: 02/01/15 14:14:04 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCCreateEntityCommand.java Log: Changed to use merged CMR field and CMP field interface. Changed to use field lists instead of field arrays. Revision ChangesPath 1.12 +47 -62 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCCreateEntityCommand.java Index: JDBCCreateEntityCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCCreateEntityCommand.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- JDBCCreateEntityCommand.java 2002/01/05 12:08:50 1.11 +++ JDBCCreateEntityCommand.java 2002/01/15 22:14:04 1.12 @@ -12,12 +12,14 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import javax.ejb.CreateException; import javax.ejb.DuplicateKeyException; import javax.sql.DataSource; import org.jboss.ejb.EntityEnterpriseContext; -import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.logging.Logger; @@ -31,66 +33,60 @@ * @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.11 $ + * @version $Revision: 1.12 $ */ public class JDBCCreateEntityCommand { private JDBCStoreManager manager; private JDBCEntityBridge entity; private Logger log; - private JDBCCMPFieldBridge[] insertFields; + private List insertFields; private String entityExistsSQL; private String insertEntitySQL; private boolean createAllowed; - + public JDBCCreateEntityCommand(JDBCStoreManager manager) { this.manager = manager; entity = manager.getEntityBridge(); // Create the Log log = Logger.getLogger( -this.getClass().getName() + -. + +this.getClass().getName() + +. + manager.getMetaData().getName()); - boolean debug = log.isDebugEnabled(); - // set create allowed createAllowed = true; - JDBCCMPFieldBridge[] cmpFields = entity.getJDBCCMPFields(); - for(int i=0; icmpFields.length; i++) { - if(cmpFields[i].isPrimaryKeyMember() cmpFields[i].isReadOnly()) { + List fields = entity.getFields(); + for(Iterator iter = fields.iterator(); iter.hasNext(); ) { + JDBCFieldBridge field = (JDBCFieldBridge)iter.next(); + if(field.isPrimaryKeyMember() field.isReadOnly()) { createAllowed = false; break; } } - + if(createAllowed) { insertFields = getInsertFields(); entityExistsSQL = createEntityExistsSQL(); insertEntitySQL = createInsertEntitySQL(); - if (debug) - { -log.debug(Entity Exists SQL: + entityExistsSQL); -log.debug(Insert Entity SQL: + entityExistsSQL); - } - } - else if (debug) - { + log.debug(Entity Exists SQL: + entityExistsSQL); + log.debug(Insert Entity SQL: + insertEntitySQL); + } else { log.debug(Create will not be allowed.); } } - - private JDBCCMPFieldBridge[] getInsertFields() { - JDBCCMPFieldBridge[] cmpFields = entity.getJDBCCMPFields(); - ArrayList fields = new ArrayList(cmpFields.length); - - for(int i=0; icmpFields.length; i++) { - if(!cmpFields[i].isReadOnly()) { -fields.add(cmpFields[i]); + + private List getInsertFields() { + List fields = entity.getFields(); + List insertFields = new ArrayList(fields.size()); + + for(Iterator iter = fields.iterator(); iter.hasNext(); ) { + JDBCFieldBridge field = (JDBCFieldBridge)iter.next(); + if(!field.isReadOnly()) { +insertFields.add(field); } } - return (JDBCCMPFieldBridge[])fields.toArray( -new JDBCCMPFieldBridge[fields.size()]); + return insertFields; } private String createEntityExistsSQL() { @@ -98,7 +94,7 @@ sql.append(SELECT COUNT(*)); sql.append( FROM ).append(entity.getTableName()); sql.append( WHERE ); - sql.append(SQLUtil.getWhereClause(entity.getJDBCPrimaryKeyFields())); + sql.append(SQLUtil.getWhereClause(entity.getPrimaryKeyFields())); return sql.toString(); } @@ -125,7 +121,9
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCDeleteRelationsCommand.java
User: dsundstrom Date: 02/01/15 14:18:36 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCDeleteRelationsCommand.java Log: Converted field arrays to lists. Revision ChangesPath 1.8 +17 -22 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- JDBCDeleteRelationsCommand.java 2002/01/05 12:08:50 1.7 +++ JDBCDeleteRelationsCommand.java 2002/01/15 22:18:36 1.8 @@ -9,6 +9,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Iterator; +import java.util.List; import javax.ejb.EJBException; import javax.sql.DataSource; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; @@ -21,7 +22,7 @@ * Deletes relations from a relation table. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ public class JDBCDeleteRelationsCommand { private JDBCStoreManager manager; @@ -48,33 +49,29 @@ return; } - boolean debug = log.isDebugEnabled(); - String sql = createSQL(relationData); - + Connection con = null; PreparedStatement ps = null; - JDBCRelationMetaData relationMetaData = + JDBCRelationMetaData relationMetaData = relationData.getLeftCMRField().getRelationMetaData(); try { // get the connection DataSource dataSource = relationMetaData.getDataSource(); con = dataSource.getConnection(); - + // create the statement - if (debug) -log.debug(Executing SQL: + sql); + log.debug(Executing SQL: + sql); ps = con.prepareStatement(sql); - + // set the parameters setParameters(ps, relationData); // execute statement int rowsAffected = ps.executeUpdate(); - if (debug) -log.debug(Create: Rows affected = + rowsAffected); + log.debug(Create: Rows affected = + rowsAffected); } catch(Exception e) { - throw new EJBException(Could not delete relations from + + throw new EJBException(Could not delete relations from + relationMetaData.getTableName(), e); } finally { JDBCUtil.safeClose(ps); @@ -114,27 +111,25 @@ PreparedStatement ps, RelationData relationData) throws Exception { - int parameterIndex = 1; + int index = 1; Iterator pairs = relationData.removedRelations.iterator(); while(pairs.hasNext()) { RelationPair pair = (RelationPair)pairs.next(); // left keys Object leftId = pair.getLeftId(); - JDBCCMPFieldBridge[] leftKeyFields = - relationData.getLeftCMRField().getTableKeyFields(); - for(int i=0; ileftKeyFields.length; i++) { -parameterIndex = leftKeyFields[i].setPrimaryKeyParameters( - ps, parameterIndex, leftId); + List leftFields = relationData.getLeftCMRField().getTableKeyFields(); + for(Iterator fields=leftFields.iterator(); fields.hasNext();) { +JDBCCMPFieldBridge field = (JDBCCMPFieldBridge)fields.next(); +index = field.setPrimaryKeyParameters(ps, index, leftId); } // right keys Object rightId = pair.getRightId(); - JDBCCMPFieldBridge[] rightKeyFields = - relationData.getRightCMRField().getTableKeyFields(); - for(int i=0; irightKeyFields.length; i++) { -parameterIndex = rightKeyFields[i].setPrimaryKeyParameters( - ps, parameterIndex, rightId); + List rightFields = relationData.getRightCMRField().getTableKeyFields(); + for(Iterator fields=rightFields.iterator(); fields.hasNext();) { +JDBCCMPFieldBridge field = (JDBCCMPFieldBridge)fields.next(); +index = field.setPrimaryKeyParameters(ps, index, rightId); } } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByPrimaryKeyQuery.java
User: dsundstrom Date: 02/01/15 14:20:30 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByPrimaryKeyQuery.java Log: Added support for read ahead on find. Revision ChangesPath 1.3 +20 -5 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindByPrimaryKeyQuery.java Index: JDBCFindByPrimaryKeyQuery.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindByPrimaryKeyQuery.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JDBCFindByPrimaryKeyQuery.java2001/11/29 20:40:05 1.2 +++ JDBCFindByPrimaryKeyQuery.java2002/01/15 22:20:30 1.3 @@ -4,11 +4,14 @@ * Distributable under LGPL license. * See terms of license at gnu.org. */ - package org.jboss.ejb.plugins.cmp.jdbc; +import java.util.ArrayList; +import java.util.List; + import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; /** * JDBCBeanExistsCommand is a JDBC query that checks if an id exists @@ -18,7 +21,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ public class JDBCFindByPrimaryKeyQuery extends JDBCAbstractQueryCommand { @@ -29,12 +32,24 @@ JDBCEntityBridge entity = manager.getEntityBridge(); + // set the preload fields + JDBCReadAheadMetaData readAhead = q.getReadAhead(); + if(!readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + setPreloadFields(entity.getLoadGroup(eagerLoadGroupName)); + } + + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(entity.getPrimaryKeyFields()); + loadFields.addAll(getPreloadFields()); + + // generate the sql StringBuffer sql = new StringBuffer(); - sql.append(SELECT ).append(SQLUtil.getColumnNamesClause( - entity.getJDBCPrimaryKeyFields())); + sql.append(SELECT ).append(SQLUtil.getColumnNamesClause(loadFields)); sql.append( FROM ).append(entity.getTableName()); sql.append( WHERE ).append(SQLUtil.getWhereClause( - entity.getJDBCPrimaryKeyFields())); + entity.getPrimaryKeyFields())); setSQL(sql.toString()); setParameterList(QueryParameter.createPrimaryKeyParameters(0, entity)); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByQuery.java
User: dsundstrom Date: 02/01/15 14:21:19 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCFindByQuery.java Log: Added support for read ahead on find. Revision ChangesPath 1.2 +21 -5 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindByQuery.java Index: JDBCFindByQuery.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCFindByQuery.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCFindByQuery.java 2001/11/28 11:32:54 1.1 +++ JDBCFindByQuery.java 2002/01/15 22:21:19 1.2 @@ -6,9 +6,13 @@ */ package org.jboss.ejb.plugins.cmp.jdbc; +import java.util.ArrayList; +import java.util.List; + import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; /** * JDBCFindByQuery automatic finder used in CMP 1.x. @@ -19,7 +23,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];danch (Dan Christopherson)/a - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public class JDBCFindByQuery extends JDBCAbstractQueryCommand { @@ -40,16 +44,28 @@ String cmpFieldName = Character.toLowerCase(finderName.charAt(6)) + finderName.substring(7); + // get the field cmpField = (JDBCCMPFieldBridge)entity.getCMPFieldByName(cmpFieldName); if(cmpField == null) { throw new IllegalArgumentException( -No finder for this method: + finderName); + No finder for this method: + finderName); } - // Compute SQL + // set the preload fields + JDBCReadAheadMetaData readAhead = q.getReadAhead(); + if(!readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + setPreloadFields(entity.getLoadGroup(eagerLoadGroupName)); + } + + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(entity.getPrimaryKeyFields()); + loadFields.addAll(getPreloadFields()); + + // generate the sql StringBuffer sql = new StringBuffer(); - sql.append(SELECT ).append(SQLUtil.getColumnNamesClause( - entity.getJDBCPrimaryKeyFields())); + sql.append(SELECT ).append(SQLUtil.getColumnNamesClause(loadFields)); sql.append( FROM ).append(entity.getTableName()); sql.append( WHERE ).append(SQLUtil.getWhereClause(cmpField)); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCInsertRelationsCommand.java
User: dsundstrom Date: 02/01/15 14:22:10 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCInsertRelationsCommand.java Log: Converted field arrays to field lists. Revision ChangesPath 1.10 +27 -32 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCInsertRelationsCommand.java Index: JDBCInsertRelationsCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCInsertRelationsCommand.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JDBCInsertRelationsCommand.java 2002/01/05 12:08:51 1.9 +++ JDBCInsertRelationsCommand.java 2002/01/15 22:22:10 1.10 @@ -9,6 +9,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Iterator; +import java.util.List; import javax.ejb.EJBException; import javax.sql.DataSource; @@ -22,7 +23,7 @@ * Inserts relations into a relation table. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public class JDBCInsertRelationsCommand { protected JDBCStoreManager manager; @@ -39,43 +40,39 @@ . + manager.getMetaData().getName()); } - + public void execute(RelationData relationData) { if(relationData.addedRelations.size() == 0) { return; } - + Connection con = null; PreparedStatement ps = null; - - boolean debug = log.isDebugEnabled(); - - JDBCRelationMetaData relationMetaData = + + JDBCRelationMetaData relationMetaData = relationData.getLeftCMRField().getRelationMetaData(); try { // get the connection DataSource dataSource = relationMetaData.getDataSource(); con = dataSource.getConnection(); - + // get the sql String sql = getSQL(relationData); - + // get a prepared statement - if (debug) -log.debug(Executing SQL: + sql); + log.debug(Executing SQL: + sql); ps = con.prepareStatement(sql); - + Iterator pairs = relationData.addedRelations.iterator(); while(pairs.hasNext()) { RelationPair pair = (RelationPair)pairs.next(); - + // set the parameters setParameters(ps, relationData, pair); - + int rowsAffected = ps.executeUpdate(); - -if (debug) - log.debug(Rows affected = + rowsAffected); + +log.debug(Rows affected = + rowsAffected); } } catch(Exception e) { throw new EJBException(Could insert relations into + @@ -85,14 +82,14 @@ JDBCUtil.safeClose(con); } } - + protected String getSQL(RelationData relationData) throws Exception { JDBCCMRFieldBridge left = relationData.getLeftCMRField(); JDBCCMRFieldBridge right = relationData.getRightCMRField(); - + StringBuffer sql = new StringBuffer(); sql.append(INSERT INTO ).append( - left.getRelationMetaData().getTableName()); + left.getRelationMetaData().getTableName()); sql.append( (); sql.append(SQLUtil.getColumnNamesClause(left.getTableKeyFields())); @@ -104,33 +101,31 @@ sql.append(SQLUtil.getValuesClause(left.getTableKeyFields())); sql.append(, ); sql.append(SQLUtil.getValuesClause(right.getTableKeyFields())); - sql.append()); + sql.append()); return sql.toString(); } - + protected void setParameters( PreparedStatement ps, RelationData relationData, RelationPair pair) throws Exception { - int parameterIndex = 1; + int index = 1; // left keys Object leftId = pair.getLeftId(); - JDBCCMPFieldBridge[] leftKeyFields = -relationData.getLeftCMRField().getTableKeyFields(); - for(int i=0; ileftKeyFields.length; i++) { - parameterIndex = leftKeyFields[i].setPrimaryKeyParameters( - ps, parameterIndex, leftId); + List leftFields = relationData.getLeftCMRField().getTableKeyFields(); + for(Iterator fields=leftFields.iterator(); fields.hasNext();) { + JDBCCMPFieldBridge field = (JDBCCMPFieldBridge)fields.next(); + index = field.setPrimaryKeyParameters(ps, index, leftId); } // right keys Object rightId = pair.getRightId(); - JDBCCMPFieldBridge[] rightKeyFields = -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCQueryManager.java
User: dsundstrom Date: 02/01/15 14:23:17 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCQueryManager.java Log: Cleaned up code. Revision ChangesPath 1.3 +23 -29 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCQueryManager.java Index: JDBCQueryManager.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCQueryManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- JDBCQueryManager.java 2002/01/05 12:08:51 1.2 +++ JDBCQueryManager.java 2002/01/15 22:23:17 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 JDBCQueryManager { private final Map knownQueries = new HashMap(); @@ -54,17 +54,16 @@ public void start() throws DeploymentException { Logger log = Logger.getLogger( -this.getClass().getName() + -. + +this.getClass().getName() + +. + manager.getMetaData().getName()); - boolean debug = log.isDebugEnabled(); - - JDBCCommandFactory factory = manager.getCommandFactory(); - + + JDBCCommandFactory factory = manager.getCommandFactory(); + Class homeClass = manager.getContainer().getHomeClass(); Class localHomeClass = manager.getContainer().getLocalHomeClass(); - // + // // findByPrimaryKey // JDBCEntityBridge entity = manager.getEntityBridge(); @@ -72,52 +71,50 @@ try { // try to get the finder method on the home interface Method method = homeClass.getMethod( - findByPrimaryKey, + findByPrimaryKey, new Class[] {entity.getPrimaryKeyClass()}); - + // got it add it to known finders JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method); knownQueries.put( - method, + method, factory.createFindByPrimaryKeyQuery(q)); -if (debug) - log.debug(Added findByPrimaryKey query command for + +log.debug(Added findByPrimaryKey query command for + home interface); } catch(NoSuchMethodException e) { throw new DeploymentException(Home interface does not + have a findByPrimaryKey method); } } - + if(localHomeClass != null) { try { // try to get the finder method on the local home interface Method method = localHomeClass.getMethod( - findByPrimaryKey, + findByPrimaryKey, new Class[] {entity.getPrimaryKeyClass()}); - + // got it add it to known finders JDBCQueryMetaData q = new JDBCAutomaticQueryMetaData(method); knownQueries.put( - method, + method, factory.createFindByPrimaryKeyQuery(q)); -if (debug) - log.debug(Added findByPrimaryKey query command for + +log.debug(Added findByPrimaryKey query command for + local home interface); } catch(NoSuchMethodException e) { throw new DeploymentException(Local home interface does + not have a findByPrimaryKey method); } } - + // // Custom finders - Overrides defined and automatic finders. // Class ejbClass = manager.getMetaData().getEntityClass(); - Method[] customMethods = ejbClass.getMethods(); + Method[] customMethods = ejbClass.getMethods(); for (int i = 0; i customMethods.length; i++) { Method m = customMethods[i]; String methodName = m.getName(); @@ -128,16 +125,15 @@ try { // try to get the finder method on the home interface Method interfaceMethod = homeClass.getMethod( -interfaceName, +interfaceName, m.getParameterTypes()); - + // got it add it to known finders knownQueries.put( -interfaceMethod, +interfaceMethod, new JDBCCustomFinderQuery(manager, m)); - if (debug)
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCRemoveEntityCommand.java
User: dsundstrom Date: 02/01/15 14:24:25 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCRemoveEntityCommand.java Log: Converted field arrays to field lists. Revision ChangesPath 1.13 +30 -26 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCRemoveEntityCommand.java Index: JDBCRemoveEntityCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCRemoveEntityCommand.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JDBCRemoveEntityCommand.java 2002/01/05 12:08:51 1.12 +++ JDBCRemoveEntityCommand.java 2002/01/15 22:24:25 1.13 @@ -13,6 +13,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import javax.ejb.EJBLocalObject; import javax.ejb.RemoveException; import javax.sql.DataSource; @@ -29,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.12 $ + * @version $Revision: 1.13 $ */ public class JDBCRemoveEntityCommand { @@ -52,37 +53,34 @@ sql.append(DELETE); sql.append( FROM ).append(entity.getTableName()); sql.append( WHERE ).append(SQLUtil.getWhereClause( - entity.getJDBCPrimaryKeyFields())); + entity.getPrimaryKeyFields())); removeEntitySQL = sql.toString(); - if (log.isDebugEnabled()) - log.debug(Remove SQL: + removeEntitySQL); + log.debug(Remove SQL: + removeEntitySQL); } - + public void execute(EntityEnterpriseContext context) throws RemoveException { - + // remove entity from all relations HashMap oldRelations = removeFromRelations(context); // update the related entities (stores the removal from relationships) - if(entity.getJDBCCMRFields().length 0) { + if(!entity.getCMRFields().isEmpty()) { manager.getContainer().synchronizeEntitiesWithinTransaction( context.getTransaction()); } - + Connection con = null; PreparedStatement ps = null; int rowsAffected = 0; - boolean debug = log.isDebugEnabled(); try { // get the connection DataSource dataSource = entity.getDataSource(); con = dataSource.getConnection(); - + // create the statement - if (debug) -log.debug(Executing SQL: + removeEntitySQL); + log.debug(Executing SQL: + removeEntitySQL); ps = con.prepareStatement(removeEntitySQL); // set the parameters @@ -91,7 +89,7 @@ // execute statement rowsAffected = ps.executeUpdate(); } catch(Exception e) { - log.error(e); + log.error(Could not remove + context.getId(), e); throw new RemoveException(Could not remove + context.getId()); } finally { JDBCUtil.safeClose(ps); @@ -102,27 +100,31 @@ if(rowsAffected == 0) { throw new RemoveException(Could not remove entity); } - if (debug) - log.debug(Remove: Rows affected = + rowsAffected); + log.debug(Remove: Rows affected = + rowsAffected); // cascate-delete to old relations, if relation uses cascade. cascadeDelete(oldRelations); + + manager.getReadAheadCache().removeCachedData(context.getId()); } private HashMap removeFromRelations(EntityEnterpriseContext context) { HashMap oldRelations = new HashMap(); - JDBCCMRFieldBridge[] cmrFields = entity.getJDBCCMRFields(); // remove entity from all relations before removing from db - for(int i=0; icmrFields.length; i++) { - if(cmrFields[i].isCollectionValued()) { -Collection oldValue = (Collection)cmrFields[i].getValue(context); -oldRelations.put(cmrFields[i], new HashSet(oldValue)); + List cmrFields = entity.getCMRFields(); + for(Iterator iter = cmrFields.iterator(); iter.hasNext();) { + JDBCCMRFieldBridge cmrField = (JDBCCMRFieldBridge)iter.next(); + + if(cmrField.isCollectionValued()) { +Collection oldValue = + (Collection)cmrField.getInstanceValue(context); +oldRelations.put(cmrField, new HashSet(oldValue)); oldValue.clear(); } else { -Object oldValue = cmrFields[i].getValue(context); -oldRelations.put(cmrFields[i], oldValue); -cmrFields[i].setValue(context, null); +Object oldValue =
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStopCommand.java
User: dsundstrom Date: 02/01/15 14:26:41 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStopCommand.java Log: Converted from field arrays to lists. Revision ChangesPath 1.9 +10 -11 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStopCommand.java Index: JDBCStopCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStopCommand.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JDBCStopCommand.java 2002/01/05 12:08:51 1.8 +++ JDBCStopCommand.java 2002/01/15 22:26:41 1.9 @@ -12,6 +12,8 @@ import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; +import java.util.Iterator; +import java.util.List; import javax.sql.DataSource; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; @@ -27,7 +29,7 @@ * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @author a href=mailto:[EMAIL PROTECTED];Justin Forder/a - * @version $Revision: 1.8 $ + * @version $Revision: 1.9 $ */ public class JDBCStopCommand { @@ -50,17 +52,17 @@ public void execute() { if(entityMetaData.getRemoveTable()) { - if (log.isDebugEnabled()) -log.debug(Droping table for entity + entity.getEntityName()); + log.debug(Droping table for entity + entity.getEntityName()); dropTable(entity.getDataSource(), entityMetaData.getTableName()); } // drop relation tables - JDBCCMRFieldBridge[] cmrFields = entity.getJDBCCMRFields(); - for(int i=0; icmrFields.length; i++) { - JDBCRelationMetaData relationMetaData = - cmrFields[i].getRelationMetaData(); + List cmrFields = entity.getCMRFields(); + for(Iterator iter = cmrFields.iterator(); iter.hasNext();) { + JDBCCMRFieldBridge cmrField = (JDBCCMRFieldBridge)iter.next(); + JDBCRelationMetaData relationMetaData = cmrField.getRelationMetaData(); + if(relationMetaData.isTableMappingStyle() relationMetaData.getTableExists()) { @@ -77,7 +79,6 @@ private void dropTable(DataSource dataSource, String tableName) { Connection con = null; ResultSet rs = null; - boolean debug = log.isDebugEnabled(); // was the table already delete? try { @@ -88,8 +89,7 @@ return; } } catch(SQLException e) { - if (debug) -log.debug(Error getting database metadata for DROP TABLE command. + + log.debug(Error getting database metadata for DROP TABLE command. + DROP TABLE will not be executed. , e); return; } finally { @@ -117,8 +117,7 @@ // success log.info(Dropped table ' + tableName + ' successfully.); } catch (Exception e) { - if (debug) -log.debug(Could not drop table + tableName + : + e.getMessage()); + log.debug(Could not drop table + tableName + : + e.getMessage()); try { manager.getContainer().getTransactionManager().rollback (); } catch (Exception _e) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStoreEntityCommand.java
User: dsundstrom Date: 02/01/15 14:27:34 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStoreEntityCommand.java Log: Converted from field arrays to field lists. Revision ChangesPath 1.11 +22 -19 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStoreEntityCommand.java Index: JDBCStoreEntityCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStoreEntityCommand.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JDBCStoreEntityCommand.java 2002/01/05 12:08:51 1.10 +++ JDBCStoreEntityCommand.java 2002/01/15 22:27:34 1.11 @@ -9,10 +9,12 @@ import java.sql.Connection; import java.sql.PreparedStatement; +import java.util.Iterator; +import java.util.List; import javax.ejb.EJBException; import org.jboss.ejb.EntityEnterpriseContext; -import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.logging.Logger; @@ -27,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];Sebastien Alborini/a - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public class JDBCStoreEntityCommand { private JDBCStoreManager manager; @@ -46,23 +48,20 @@ } public void execute(EntityEnterpriseContext ctx) { - JDBCCMPFieldBridge[] dirtyFields = -(JDBCCMPFieldBridge[])entity.getDirtyFields(ctx); - - boolean debug = log.isDebugEnabled(); - if(dirtyFields.length == 0) { - if (debug) -log.debug(Store command NOT executed. Entity is not dirty: pk= + + List dirtyFields = entity.getDirtyFields(ctx); + + if(dirtyFields.isEmpty()) { + log.debug(Store command NOT executed. Entity is not dirty: pk= + ctx.getId()); return; } // generate sql - StringBuffer sql = new StringBuffer(); + StringBuffer sql = new StringBuffer(); sql.append(UPDATE ).append(entity.getTableName()); sql.append( SET ).append(SQLUtil.getSetClause(dirtyFields)); sql.append( WHERE ).append( -SQLUtil.getWhereClause(entity.getJDBCPrimaryKeyFields())); +SQLUtil.getWhereClause(entity.getPrimaryKeyFields())); Connection con = null; PreparedStatement ps = null; @@ -70,19 +69,23 @@ try { // get the connection con = entity.getDataSource().getConnection(); - + // create the statement - if (debug) -log.debug(Executing SQL: + sql); + log.debug(Executing SQL: + sql); ps = con.prepareStatement(sql.toString()); - + // set the parameters int index = 1; - index = entity.setInstanceParameters(ps, index, ctx, dirtyFields); + for(Iterator iter = dirtyFields.iterator(); iter.hasNext(); ) { +JDBCFieldBridge field = (JDBCFieldBridge)iter.next(); +index = field.setInstanceParameters(ps, index, ctx); + } index = entity.setPrimaryKeyParameters(ps, index, ctx.getId()); // execute statement rowsAffected = ps.executeUpdate(); + } catch(EJBException e) { + throw e; } catch(Exception e) { throw new EJBException(Store failed, e); } finally { @@ -96,12 +99,12 @@ affected row: rowsAffected= + rowsAffected + id= + ctx.getId()); } - if (debug) - log.debug(Create: Rows affected = + rowsAffected); + log.debug(Create: Rows affected = + rowsAffected); // Mark the inserted fields as clean. - for(int i=0; idirtyFields.length; i++) { - dirtyFields[i].setClean(ctx); + for(Iterator iter = dirtyFields.iterator(); iter.hasNext(); ) { + JDBCFieldBridge field = (JDBCFieldBridge)iter.next(); + field.setClean(ctx); } } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStartCommand.java
User: dsundstrom Date: 02/01/15 14:25:49 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStartCommand.java Log: Converted to merged CMR field and CMP field interface. Converted from field arrays to lists. Revision ChangesPath 1.16 +43 -68 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java Index: JDBCStartCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStartCommand.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- JDBCStartCommand.java 2002/01/05 12:08:51 1.15 +++ JDBCStartCommand.java 2002/01/15 22:25:49 1.16 @@ -12,8 +12,11 @@ import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; +import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; import javax.sql.DataSource; @@ -36,7 +39,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];Michel de Groot/a - * @version $Revision: 1.15 $ + * @version $Revision: 1.16 $ */ public class JDBCStartCommand { @@ -70,8 +73,6 @@ public void execute() throws Exception { - boolean debug = log.isDebugEnabled(); - // Create table if necessary if(!entity.getTableExists()) { if(entityMetaData.getCreateTable()) { @@ -79,36 +80,33 @@ entity.getDataSource(), entity.getTableName(), getEntityCreateTableSQL()); - } - else if (debug) - { + } else { log.debug(Table not create as requested: + entity.getTableName()); } entity.setTableExists(true); } - + // create relation tables - JDBCCMRFieldBridge[] cmrFields = entity.getJDBCCMRFields(); - for(int i=0; icmrFields.length; i++) { - JDBCRelationMetaData relationMetaData = - cmrFields[i].getRelationMetaData(); + List cmrFields = entity.getCMRFields(); + for(Iterator iter = cmrFields.iterator(); iter.hasNext();) { + JDBCCMRFieldBridge cmrField = (JDBCCMRFieldBridge)iter.next(); + JDBCRelationMetaData relationMetaData = cmrField.getRelationMetaData(); + // if the table for the related entity has been created - if(cmrFields[i].getRelatedEntity().getTableExists()) { + if(cmrField.getRelatedEntity().getTableExists()) { // create the relation table if(relationMetaData.isTableMappingStyle() !relationMetaData.getTableExists()) { - + if(relationMetaData.getCreateTable()) { createTable( relationMetaData.getDataSource(), relationMetaData.getTableName(), -getRelationCreateTableSQL(cmrFields[i])); - } - else if (debug) - { +getRelationCreateTableSQL(cmrField)); + } else { log.debug(Relation table not create as requested: + relationMetaData.getTableName()); } @@ -116,10 +114,10 @@ relationMetaData.setTableExists(true); // Create my fk constraint -addForeignKeyConstraint(cmrFields[i]); +addForeignKeyConstraint(cmrField); // Create related fk constraint -addForeignKeyConstraint(cmrFields[i].getRelatedCMRField()); +addForeignKeyConstraint(cmrField.getRelatedCMRField()); } } } @@ -137,27 +135,24 @@ Connection con = null; Statement statement = null; - boolean debug = log.isDebugEnabled(); try { // since we use the pools, we have to do this within a transaction manager.getContainer().getTransactionManager().begin (); // get the connection con = dataSource.getConnection(); - + // create the statement statement = con.createStatement(); - + // execute sql - if (debug) -log.debug(Executing SQL: + sql); + log.debug(Executing SQL: + sql); statement.executeUpdate(sql); // commit the transaction manager.getContainer().getTransactionManager().commit (); } catch (Exception e) { - if (debug) -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadEntityCommand.java
User: dsundstrom Date: 02/01/15 14:33:08 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadEntityCommand.java Log: Added support for merged CMR field and CMP field interface. Added support for new ReadAheadCache. Merged functions from JDBCLoadFieldCommand and JDBCReadAheadCommand. Revision ChangesPath 1.14 +164 -54 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadEntityCommand.java Index: JDBCLoadEntityCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadEntityCommand.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JDBCLoadEntityCommand.java2002/01/05 12:08:51 1.13 +++ JDBCLoadEntityCommand.java2002/01/15 22:33:08 1.14 @@ -11,15 +11,20 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import javax.ejb.EJBException; import javax.ejb.NoSuchEntityException; import org.jboss.ejb.EntityEnterpriseContext; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCFunctionMappingMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCTypeMappingMetaData; import org.jboss.logging.Logger; +import org.jboss.util.FinderResults; /** * JDBCLoadEntityCommand loads the data for an instance from the table. @@ -28,18 +33,19 @@ * helpful for entitys with lots of data. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a + * @author a href=mailto:[EMAIL PROTECTED];Oleg Nitz/a * @author a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a * @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 * @author a href=mailto:[EMAIL PROTECTED];Dirk Zimmermann/a * @author a href=mailto:[EMAIL PROTECTED];danch (Dan Christopherson)/a - * @version $Revision: 1.13 $ + * @version $Revision: 1.14 $ */ public class JDBCLoadEntityCommand { - private JDBCStoreManager manager; - private JDBCEntityBridge entity; - private Logger log; + private final JDBCStoreManager manager; + private final JDBCEntityBridge entity; + private final Logger log; public JDBCLoadEntityCommand(JDBCStoreManager manager) { this.manager = manager; @@ -53,42 +59,37 @@ } public void execute(EntityEnterpriseContext ctx) { - // load the instance primary key fields + execute(null, ctx); + } + + public void execute( + JDBCCMPFieldBridge requiredField, + EntityEnterpriseContext ctx) { + + // load the instance primary key fields into the context entity.injectPrimaryKeyIntoInstance(ctx, ctx.getId()); + + // get the read ahead cache + ReadAheadCache readAheadCache = manager.getReadAheadCache(); + + // load any preloaded fields into the context + readAheadCache.load(ctx); // determine the fields to load - JDBCCMPFieldBridge[] loadFields = getLoadFields(ctx); + List loadFields = getLoadFields(requiredField, ctx); // if no there are not load fields return - if(loadFields.length == 0) { + if(loadFields.size() == 0) { return; } - // generate the sql - StringBuffer sql = new StringBuffer(); - String columnNamesClause = SQLUtil.getColumnNamesClause(loadFields); - String tableName = entity.getTableName(); - String whereClause = SQLUtil.getWhereClause(entity.getJDBCPrimaryKeyFields()); + // get the finder results associated with this context, if it exists + ReadAheadCache.EntityReadAheadInfo info = + readAheadCache.getEntityReadAheadInfo(ctx.getId()); + List loadKeys = info.getLoadKeys(); - if (entity.getMetaData().hasRowLocking()) - { - JDBCFunctionMappingMetaData rowLocking = manager.getMetaData().getTypeMapping().getRowLockingTemplate(); - if (rowLocking == null) - { -throw new IllegalStateException(row-locking is not allowed for this type of datastore); - } - else - { -String[] args = new String[] {columnNamesClause, tableName, whereClause}; -sql.append(rowLocking.getFunctionSql(args)); - } - } - else - { - sql.append(SELECT ).append(columnNamesClause); - sql.append( FROM ).append(tableName); - sql.append(
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStoreManager.java
User: dsundstrom Date: 02/01/15 14:30:36 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCStoreManager.java Log: Moved read ahead cache code to ReadAheadCache. Added support for merged CMR field and CMP field interface. Converted field arrays to lists. Revision ChangesPath 1.25 +73 -293 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStoreManager.java Index: JDBCStoreManager.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCStoreManager.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- JDBCStoreManager.java 2002/01/05 12:08:51 1.24 +++ JDBCStoreManager.java 2002/01/15 22:30:36 1.25 @@ -10,12 +10,11 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; import javax.ejb.CreateException; import javax.ejb.EJBException; @@ -59,17 +58,15 @@ * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a * @see org.jboss.ejb.EntityPersistenceStore - * @version $Revision: 1.24 $ + * @version $Revision: 1.25 $ */ public class JDBCStoreManager implements EntityPersistenceStore { /** -* To simplify null values handling in the preloaded data pool we use -* this value instead of 'null' +* The key used to store the tx data map. */ - private static final Object NULL_VALUE = new Object(); + private static final Object TX_DATA_KEY = TX_DATA_KEY; - private static final Object TX_DATA_KEY = new Object(); private static final Map applicationData = Collections.synchronizedMap(new HashMap()); @@ -84,6 +81,8 @@ private JDBCCommandFactory commandFactory; + private ReadAheadCache readAheadCache; + // Manager life cycle commands private JDBCInitCommand initCommand; private JDBCStartCommand startCommand; @@ -104,39 +103,42 @@ private JDBCPassivateEntityCommand passivateEntityCommand; // commands - private JDBCLoadFieldCommand loadFieldCommand; - private JDBCFindByForeignKeyCommand findByForeignKeyCommand; +// private JDBCFindByForeignKeyCommand findByForeignKeyCommand; private JDBCLoadRelationCommand loadRelationCommand; private JDBCDeleteRelationsCommand deleteRelationsCommand; private JDBCInsertRelationsCommand insertRelationsCommand; - // read ahead stuff - private boolean readAheadOnLoad; - private int readAheadLimit; - private JDBCReadAheadCommand readAheadCommand; - private LRUCachePolicy readAheadCache; - /** * A map of data preloaded within some transaction for some entity. This map * is keyed by Transaction, entityKey and CMP field name * and the data is Object containing the field value. */ - private Map preloadedData = new HashMap(); +// private Map preloadedData = new HashMap(); /** * A set of transactions for which data was preloaded. */ - private Set transactions = new HashSet(); +// private Set transactions = new HashSet(); /** * A Transaction manager so that we can link preloaded data to a transaction */ private TransactionManager tm; + /** +* Gets the container for this entity. +* @return the container for this entity; null if container has not been set +*/ public EntityContainer getContainer() { return container; } + /** +* Sets the container for this entity. +* @param container the container for this entity +* @throws ClassCastException if the container is not an instance of +* EntityContainer +*/ public void setContainer(Container container) { this.container = (EntityContainer)container; this.log = Logger.getLogger( @@ -162,9 +164,16 @@ } public JDBCCommandFactory getCommandFactory() { - return (JDBCCommandFactory) commandFactory; + return commandFactory; } + public ReadAheadCache getReadAheadCache() { + return readAheadCache; + } + + // + // Genertic data containers + // public Map getApplicationDataMap() { return applicationData; } @@ -204,6 +213,8 @@ } return txDataMap; } + } catch(EJBException e) { + throw e; } catch(Exception e) { throw new EJBException(Error getting application tx data map., e); } @@ -221,6 +232,27 @@ getApplicationTxDataMap().remove(key); } + public Map
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadRelationCommand.java
User: dsundstrom Date: 02/01/15 14:34:18 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCLoadRelationCommand.java Log: Added support for readahead and preload. Merged functions from JDBCFindByForeignKey. Converted field arrays to lists. Revision ChangesPath 1.11 +304 -49 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadRelationCommand.java Index: JDBCLoadRelationCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCLoadRelationCommand.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- JDBCLoadRelationCommand.java 2002/01/05 12:08:51 1.10 +++ JDBCLoadRelationCommand.java 2002/01/15 22:34:17 1.11 @@ -10,28 +10,39 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import javax.ejb.EJBException; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCFunctionMappingMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCTypeMappingMetaData; import org.jboss.logging.Logger; +import org.jboss.util.FinderResults; /** * Loads relations for a particular entity from a relation table. * * @author a href=mailto:[EMAIL PROTECTED];Dain Sundstrom/a - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public class JDBCLoadRelationCommand { - private JDBCStoreManager manager; - private Logger log; + private final JDBCStoreManager manager; + private final JDBCEntityBridge entity; + private final Logger log; public JDBCLoadRelationCommand(JDBCStoreManager manager) { this.manager = manager; + this.entity = manager.getEntityBridge(); // Create the Log log = Logger.getLogger( @@ -40,38 +51,22 @@ manager.getMetaData().getName()); } - public Set execute(JDBCCMRFieldBridge cmrField, Object pk) { - // get the key fields - JDBCCMPFieldBridge[] myKeyFields = cmrField.getTableKeyFields(); - JDBCCMPFieldBridge[] relatedKeyFields = -cmrField.getRelatedCMRField().getTableKeyFields(); - - // generate SQL - StringBuffer sql = new StringBuffer(); - String columnNamesClause = SQLUtil.getColumnNamesClause(cmrField.getRelatedCMRField().getTableKeyFields()); - String tableName = cmrField.getRelationMetaData().getTableName(); - String whereClause = SQLUtil.getWhereClause(cmrField.getTableKeyFields()); - - if (cmrField.getRelationMetaData().hasRowLocking()) - { - JDBCFunctionMappingMetaData rowLocking = manager.getMetaData().getTypeMapping().getRowLockingTemplate(); - if (rowLocking == null) - { -throw new IllegalStateException(row-locking is not allowed for this type of datastore); - } - else - { -String[] args = new String[] {columnNamesClause, tableName, whereClause}; -sql.append(rowLocking.getFunctionSql(args)); - } - } - else - { - sql.append(SELECT ).append(columnNamesClause); - sql.append( FROM ).append(tableName); - sql.append( WHERE ).append(whereClause); - } + public Collection execute(JDBCCMRFieldBridge cmrField, Object pk) { + JDBCCMRFieldBridge relatedCMRField = cmrField.getRelatedCMRField(); + // get the read ahead cahces + ReadAheadCache readAheadCache = manager.getReadAheadCache(); + ReadAheadCache relatedReadAheadCache = +cmrField.getRelatedManager().getReadAheadCache(); + + // get the finder results associated with this context, if it exists + ReadAheadCache.EntityReadAheadInfo info = +readAheadCache.getEntityReadAheadInfo(pk); + List loadKeys = info.getLoadKeys(); + + // generate the sql + String sql = getSQL(cmrField, loadKeys.size()); + Connection con = null; PreparedStatement ps = null; try { @@ -79,39 +74,299 @@ con = cmrField.getRelationMetaData().getDataSource().getConnection(); // create the statement - if
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql SQLTarget.java
User: dsundstrom Date: 02/01/15 14:40:37 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql SQLTarget.java Log: Added support for read ahead on find. Converted from field arrays to field lists. Revision ChangesPath 1.11 +44 -22 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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SQLTarget.java2001/11/29 20:40:05 1.10 +++ SQLTarget.java2002/01/15 22:40:36 1.11 @@ -27,9 +27,11 @@ import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCFunctionMappingMetaData; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCTypeMappingMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; public class SQLTarget implements DeepCloneable { private final Method method; @@ -38,6 +40,7 @@ private final Application application; private final Map managerByAbstractSchemaName = new Hashtable(); private final List inputParameters = new ArrayList(); + private final JDBCReadAheadMetaData readAhead; private boolean isSelectDistinct; private String selectPath; @@ -53,11 +56,13 @@ */ public SQLTarget(Method method, JDBCTypeFactory typeFactory, - Application application) { + Application application, + JDBCReadAheadMetaData readAhead) { this.method = method; this.typeFactory = typeFactory; this.application = application; + this.readAhead = readAhead; if(method.getReturnType().equals(Set.class)) { isSelectDistinct = true; @@ -90,6 +95,7 @@ method = target.method; typeFactory = target.typeFactory; application = target.application; + readAhead = target.readAhead; idManager = new IdentifierManager(target.idManager); managerByAbstractSchemaName.putAll(target.managerByAbstractSchemaName); inputParameters.addAll(target.inputParameters); @@ -464,10 +470,16 @@ return null; } + inputParameters.addAll(QueryParameter.createParameters( +compareToParameter.getNumber() - 1, +entity)); +/* // create the parameter objects - JDBCCMPFieldBridge[] pkFields = entity.getJDBCPrimaryKeyFields(); - for(int i=0; ipkFields.length; i++) { - JDBCType type = pkFields[i].getJDBCType(); + List pkFields = entity.getPrimaryKeyFields(); + for(Iterator iter = pkFields.iterator(); iter.hasNext();) { + JDBCFieldBridge pkField = (JDBCFieldBridge)iter.next(); + + JDBCType type = pkField.getJDBCType(); if(type instanceof JDBCTypeComplex) { JDBCTypeComplexProperty[] props = ((JDBCTypeComplex)type).getProperties(); @@ -475,7 +487,7 @@ QueryParameter param = new QueryParameter( compareToParameter.getNumber() - 1, false, // isPrimaryKeyParameter -pkFields[i], +pkField, props[j], props[j].getJDBCType()); inputParameters.add(param); @@ -484,13 +496,13 @@ QueryParameter param = new QueryParameter( compareToParameter.getNumber() - 1, false, // isPrimaryKeyParameter - pkFields[i], + pkField, null, type.getJDBCTypes()[0]); inputParameters.add(param); } } - +*/ // generate the sql StringBuffer buf = new StringBuffer(); buf.append((); @@ -498,7 +510,8 @@ buf.append(NOT(); } - buf.append(SQLUtil.getWhereClause(pkFields, identifier)); + buf.append(SQLUtil.getWhereClause( + entity.getPrimaryKeyFields(), identifier)); if(compareSymbol.equals()) { buf.append()); @@ -528,7 +541,7 @@ } buf.append(SQLUtil.getSelfCompareWhereClause( -fromEntity.getJDBCPrimaryKeyFields(), +fromEntity.getPrimaryKeyFields(), fromIdentifier, toIdentifier)); @@ -557,6
[JBoss-dev] [AUTOMATED] JBoss compilation failed
= ==THIS IS AN AUTOMATED EMAIL - SEE http://www.lubega.com FOR DETAILS= = HERE ARE THE LAST 50 LINES OF THE LOG FILE [xdoclet] Loading source file /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/management/mejb/ManagementBean.java... [xdoclet] Constructing Javadoc information... [xdoclet] javadoc: warning - Import not found: org.jboss.management.mejb.MEJB - ignoring! [xdoclet] javadoc: warning - Cannot find class org.jboss.management.mejb.MEJB [xdoclet] Running homeInterface/ [xdoclet] Generating Home interface for 'org.jboss.management.mejb.ManagementBean'. [xdoclet] Running remoteInterface/ [xdoclet] Generating Remote interface for 'org.jboss.management.mejb.ManagementBean'. [xdoclet] Running session/ [xdoclet] Generating Session class for 'org.jboss.management.mejb.ManagementBean'. [xdoclet] Running deploymentdescriptor/ [xdoclet] Generating EJB deployment descriptor. [xdoclet] Running jboss/ [xdoclet] Generating jboss.xml. [xdoclet] 2 warnings compile-classes: [mkdir] Created dir: /disk/orig/home/lubega/jbossro/jboss-all/server/output/classes [javac] Compiling 603 source files to /disk/orig/home/lubega/jbossro/jboss-all/server/output/classes /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/EnterpriseContext.java:10: warning: java.security.Identity in java.security has been deprecated import java.security.Identity; ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/EnterpriseContext.java:214: warning: java.security.Identity in java.security has been deprecated public Identity getCallerIdentity() ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/EnterpriseContext.java:340: warning: java.security.Identity in java.security has been deprecated public boolean isCallerInRole(Identity id) ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/EnterpriseContext.java:340: warning: java.security.Identity in java.security has been deprecated public boolean isCallerInRole(Identity id) ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:65: unreported exception java.lang.Exception; must be caught or declared to be thrown listCache.create(); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/ReadAheadCache.java:69: unreported exception java.lang.Exception; must be caught or declared to be thrown listCache.start(); ^ /disk/orig/home/lubega/jbossro/jboss-all/server/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java:96: cannot resolve symbol symbol : variable debug location: class org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand if (debug) ^ 3 errors 4 warnings BUILD FAILED /disk/orig/home/lubega/jbossro/jboss-all/server/build.xml:385: Compile failed, messages should have been provided. Total time: 1 minute 8 seconds ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/util LRUCachePolicy.java
User: dsundstrom Date: 02/01/15 14:53:42 Modified:src/main/org/jboss/util LRUCachePolicy.java Log: Removed unused throws Exception declaraion from create and start methods. Revision ChangesPath 1.12 +3 -3 jboss/src/main/org/jboss/util/LRUCachePolicy.java Index: LRUCachePolicy.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/LRUCachePolicy.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- LRUCachePolicy.java 2001/12/19 06:45:20 1.11 +++ LRUCachePolicy.java 2002/01/15 22:53:42 1.12 @@ -12,7 +12,7 @@ * Implementation of a Least Recently Used cache policy. * * @author a href=mailto:[EMAIL PROTECTED];Simone Bordet/a - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ */ public class LRUCachePolicy implements CachePolicy @@ -68,7 +68,7 @@ * @see #start * @see #destroy */ - public void create() throws Exception + public void create() { m_map = new HashMap(); m_list = createList(); @@ -81,7 +81,7 @@ * @see #init * @see #stop */ - public void start() throws Exception + public void start() { } /** ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCReadAheadInterceptor.java
User: dsundstrom Date: 02/01/15 14:37:55 Removed: src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCReadAheadInterceptor.java Log: Read ahead of methods in a read ahead list, is not well defined yet. There may be sideaffects created by the read ahead. Therefore, the functionality will be removed until we can determine a way to methods as not having side affects. ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql SQLGenerator.java
User: dsundstrom Date: 02/01/15 14:39:41 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql SQLGenerator.java Log: Converted from field arrays to field lists. Revision ChangesPath 1.4 +118 -40 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java Index: SQLGenerator.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/ejbql/SQLGenerator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SQLGenerator.java 2001/11/28 23:09:36 1.3 +++ SQLGenerator.java 2002/01/15 22:39:41 1.4 @@ -1,11 +1,15 @@ package org.jboss.ejb.plugins.cmp.jdbc.ejbql; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Set; import org.jboss.ejb.plugins.cmp.jdbc.SQLUtil; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMPFieldBridge; import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; +import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge; import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCRelationMetaData; +import org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCReadAheadMetaData; public class SQLGenerator { private IdentifierManager idManager; @@ -14,8 +18,16 @@ this.idManager = idManager; } - public String getSQL(boolean isSelectDistinct, String selectPath, String userWhereClause) { - String selectClause = getSelectClause(isSelectDistinct, selectPath); + public String getSQL( + boolean isSelectDistinct, + String selectPath, + String userWhereClause, + JDBCReadAheadMetaData readAhead) { + + String selectClause = getSelectClause( +isSelectDistinct, +selectPath, +readAhead); String fromClause = getFromClause(); String whereClause = getWhereClause(userWhereClause); @@ -30,7 +42,11 @@ return buf.toString(); } - public String getSelectClause(boolean isSelectDistinct, String selectPath) { + public String getSelectClause( + boolean isSelectDistinct, + String selectPath, + JDBCReadAheadMetaData readAhead) { + StringBuffer buf = new StringBuffer(); buf.append(SELECT ); @@ -41,10 +57,10 @@ PathElement selectPathElement = idManager.getExistingPathElement(selectPath); if(selectPathElement instanceof AbstractSchema) { AbstractSchema schema = (AbstractSchema)selectPathElement; - buf.append(getSelectClause(schema)); + buf.append(getSelectClause(schema, readAhead)); } else if(selectPathElement instanceof CMRField) { CMRField cmrField = (CMRField)selectPathElement; - buf.append(getSelectClause(cmrField)); + buf.append(getSelectClause(cmrField, readAhead)); } else if(selectPathElement instanceof CMPField) { CMPField cmpField = (CMPField)selectPathElement; buf.append(getSelectClause(cmpField)); @@ -55,16 +71,42 @@ } return buf.toString(); } + + private String getSelectClause(AbstractSchema schema, + JDBCReadAheadMetaData readAhead) { + + JDBCEntityBridge selectEntity = schema.getEntityBridge(); - private String getSelectClause(AbstractSchema schema) { + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(selectEntity.getPrimaryKeyFields()); + if(!readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + loadFields.addAll(selectEntity.getLoadGroup(eagerLoadGroupName)); + } + + // get the identifier for this field String identifier = idManager.getTableAlias(schema); - return SQLUtil.getColumnNamesClause(schema.getEntityBridge().getJDBCPrimaryKeyFields(), identifier); + + return SQLUtil.getColumnNamesClause(loadFields, identifier); } - private String getSelectClause(CMRField cmrField) { + private String getSelectClause(CMRField cmrField, + JDBCReadAheadMetaData readAhead) { + + JDBCEntityBridge selectEntity = cmrField.getEntityBridge(); + + // get a list of all fields to be loaded + List loadFields = new ArrayList(); + loadFields.addAll(selectEntity.getPrimaryKeyFields()); + if(!readAhead.isOnFind()) { + String eagerLoadGroupName = readAhead.getEagerLoadGroup(); + loadFields.addAll(selectEntity.getLoadGroup(eagerLoadGroupName)); + } + + // get the identifier for this field String identifier = idManager.getTableAlias(cmrField); - return SQLUtil.getColumnNamesClause( -
[JBoss-dev] CVS update: jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCAbstractQueryCommand.java
User: dsundstrom Date: 02/01/15 14:57:57 Modified:src/main/org/jboss/ejb/plugins/cmp/jdbc JDBCAbstractQueryCommand.java Log: Cleaned up log.debug code. Revision ChangesPath 1.7 +5 -3 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java Index: JDBCAbstractQueryCommand.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCAbstractQueryCommand.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- JDBCAbstractQueryCommand.java 2002/01/15 21:55:33 1.6 +++ JDBCAbstractQueryCommand.java 2002/01/15 22:57:57 1.7 @@ -44,7 +44,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.6 $ + * @version $Revision: 1.7 $ */ public abstract class JDBCAbstractQueryCommand implements JDBCQueryCommand { private JDBCStoreManager manager; @@ -93,8 +93,9 @@ con = manager.getEntityBridge().getDataSource().getConnection(); // create the statement - if (debug) + if(log.isDebugEnabled()) { log.debug(Executing SQL: + sql); + } ps = con.prepareStatement(sql); // set the parameters @@ -185,8 +186,9 @@ protected void setSQL(String sql) { this.sql = sql; - if (log.isDebugEnabled()) + if(log.isDebugEnabled()) { log.debug(SQL: + sql); + } } protected void setParameterList(List p) { ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/util FinderResults.java
User: dsundstrom Date: 02/01/15 14:52:16 Modified:src/main/org/jboss/util FinderResults.java Log: Removed read ahead on find code. Revision ChangesPath 1.4 +2 -12 jboss/src/main/org/jboss/util/FinderResults.java Index: FinderResults.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/FinderResults.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FinderResults.java2001/10/09 00:59:40 1.3 +++ FinderResults.java2002/01/15 22:52:16 1.4 @@ -24,8 +24,6 @@ private Object[] queryArgs; - private boolean isReadAheadOnLoadUsed; - /** * List id is used only in the case of read ahead on load. */ @@ -39,14 +37,6 @@ this.finder = finder; this.queryArgs = args; } - public FinderResults(Collection keys, Object queryData, Object finder, Object[] args, boolean isReadAheadOnLoadUsed) { - this(keys, queryData, finder, args); - this.isReadAheadOnLoadUsed = isReadAheadOnLoadUsed; - if (isReadAheadOnLoadUsed) { - listId = nextListId; - nextListId++; - } - } public Collection getAllKeys() { return keys; } @@ -63,7 +53,7 @@ return queryArgs; } public boolean isReadAheadOnLoadUsed() { - return isReadAheadOnLoadUsed; + return false; } public long getListId() { return listId; @@ -108,4 +98,4 @@ public void clear() { keys.clear(); } -} \ No newline at end of file +} ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjbosscmp-jdbc.xml
User: dsundstrom Date: 02/01/15 15:17:09 Modified:src/etc/conf/default standardjbosscmp-jdbc.xml Log: Updated to new read-ahead style. Changed postgres Boolean type to sql-type BOOLEAN and jdbc-type CHAR. Revision ChangesPath 1.14 +9 -3 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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- standardjbosscmp-jdbc.xml 2002/01/04 22:39:46 1.13 +++ standardjbosscmp-jdbc.xml 2002/01/15 23:17:09 1.14 @@ -7,7 +7,7 @@ !-- -- !-- = -- -!-- $Id: standardjbosscmp-jdbc.xml,v 1.13 2002/01/04 22:39:46 dsundstrom Exp $ -- +!-- $Id: standardjbosscmp-jdbc.xml,v 1.14 2002/01/15 23:17:09 dsundstrom Exp $ -- jbosscmp-jdbc @@ -23,6 +23,12 @@ fk-constraintfalse/fk-constraint row-lockingfalse/row-locking preferred-relation-mappingforeign-key/preferred-relation-mapping + read-ahead + strategyon-load/strategy + page-size1000/page-size + eager-load-group*/eager-load-group + /read-ahead + list-cache-max1000/list-cache-max /defaults type-mappings @@ -483,8 +489,8 @@ mapping java-typejava.lang.Boolean/java-type - jdbc-typeTINYINT/jdbc-type - sql-typeINT2/sql-type + jdbc-typeCHAR/jdbc-type + sql-typeBOOLEAN/sql-type /mapping mapping java-typejava.lang.Byte/java-type ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/resources/org/jboss/metadata jbosscmp-jdbc_3_0.dtd
User: dsundstrom Date: 02/01/15 15:02:07 Modified:src/resources/org/jboss/metadata jbosscmp-jdbc_3_0.dtd Log: Added fk-constraint element. Updated read-ahead for on-find support. Added named load-groups. Changed lazy-load-groups and eager-load-group to use the named load-groups. Revision ChangesPath 1.6 +28 -38jboss/src/resources/org/jboss/metadata/jbosscmp-jdbc_3_0.dtd Index: jbosscmp-jdbc_3_0.dtd === RCS file: /cvsroot/jboss/jboss/src/resources/org/jboss/metadata/jbosscmp-jdbc_3_0.dtd,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- jbosscmp-jdbc_3_0.dtd 2001/12/30 19:05:41 1.5 +++ jbosscmp-jdbc_3_0.dtd 2002/01/15 23:02:07 1.6 @@ -10,7 +10,7 @@ !-- The root element of JBossCMP-JDBC configuration files. -- -!ELEMENT jbosscmp-jdbc (defaults, enterprise-beans?, relationships?, +!ELEMENT jbosscmp-jdbc (defaults?, enterprise-beans?, relationships?, dependent-value-classes?, type-mappings?) !-- @@ -18,8 +18,8 @@ entities, and relationships. -- !ELEMENT defaults (datasource?, type-mapping?, create-table?, remove-table?, - read-only?, time-out?, row-locking?, pk-constraint?, - fk-constraint?, preferred-relation-mapping?, read-ahead?) + read-only?, time-out?, row-locking?, pk-constraint?, fk-constraint?, + preferred-relation-mapping?, read-ahead?, max-list-cache?) !-- @@ -29,7 +29,6 @@ !ELEMENT datasource (#PCDATA) - !-- Should the persistence manager attempt to create tables if they are not present? @@ -108,31 +107,15 @@ !ELEMENT preferred-relation-mapping (#PCDATA) !-- -The read-ahead element can use either #PCDATA (true/false) or a -strategy, limit, and cache-size element, but not both. This -is a problem for most parsers, because it has mixed types. -We should change this synatx. --- - -!-- Specifies the read ahead strategy. -The read-ahead element must be one of the following: - read-aheadtrue/read-ahead - - read-aheadfalse/read-ahead - read-ahead -strategynone/strategy - /read-ahead - - read-ahead strategyon-load/strategy -limit255/limit -cache-size1000/cache-size +page-size255/page-size +eager-load-group*/eager-load-group /read-ahead -- -!ELEMENT read-ahead ANY +!ELEMENT read-ahead (strategy, page-size?, eager-load-group?) !-- Specifies the strategy used to read-ahead data in queries. @@ -140,22 +123,23 @@ The strategy element must be one of the two following: strategynone/strategy strategyon-load/strategy + strategyon-find/strategy -- !ELEMENT strategy (#PCDATA) !-- Specifies the number of entities that will be read in a single -read-ahead load query. This is effectively the page size. +read-ahead load query. -- -!ELEMENT limit (#PCDATA) +!ELEMENT page-size (#PCDATA) !-- -Specifies the number of simultaneous queries that can be served by +Specifies the number of simultaneous queries that can be tracked by the cache for an entity. -- -!ELEMENT cache-size (#PCDATA) +!ELEMENT max-list-cache (#PCDATA) !-- @@ -169,9 +153,9 @@ The entity element contains the configuration of an entity -- !ELEMENT entity (ejb-name, datasource?, type-mapping?, create-table?, - remove-table?, read-only?, time-out?, row-locking?, - pk-constraint?, read-ahead?, table-name?, cmp-field*, - eager-load?, lazy-load-groups*, query*) + remove-table?, read-only?, time-out?, row-locking?, pk-constraint?, + read-ahead?, list-cache-max?, table-name?, cmp-field*, load-groups?, + eager-load-group?, lazy-load-groups?, query*) !-- Name of the entity being configured. This must match an entity declared @@ -239,23 +223,28 @@ -- !ELEMENT property-name (#PCDATA) +!-- +Contains the named load groups. +-- +!ELEMENT load-groups (load-group+) + !-- -Contains the fields that are eager loaded for this entity. +A named group of fields that will be loaded together. -- -!ELEMENT eager-load (field-name*) +!ELEMENT load-group (load-group-name, description?, field-name+) !-- -Contains the groups of lazy load fields. +Contains the name of the load group that will eager loaded for this entity. -- -!ELEMENT lazy-load-groups (lazy-load-group+) +!ELEMENT eager-load-group (#PCDATA) !-- -A group of fields that will be lazy loaded together. +Contains the names of the groups that will be lazy loaded together. -- -!ELEMENT lazy-load-group (description, field-name+) +!ELEMENT
[JBoss-dev] CVS update: jboss/src/etc/conf/default standardjboss.xml
User: dsundstrom Date: 02/01/15 15:30:34 Modified:src/etc/conf/default standardjboss.xml Log: Droped removed JDBCReadAheadInterceptor from interceptor chains. Revision ChangesPath 1.33 +1 -3 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.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- standardjboss.xml 2002/01/14 01:59:48 1.32 +++ standardjboss.xml 2002/01/15 23:30:34 1.33 @@ -7,7 +7,7 @@ !-- -- !-- = -- -!-- $Id: standardjboss.xml,v 1.32 2002/01/14 01:59:48 patriot1burke Exp $ -- +!-- $Id: standardjboss.xml,v 1.33 2002/01/15 23:30:34 dsundstrom Exp $ -- jboss enforce-ejb-restrictionsfalse/enforce-ejb-restrictions @@ -26,7 +26,6 @@ interceptororg.jboss.ejb.plugins.EntityInstanceInterceptor/interceptor interceptororg.jboss.ejb.plugins.EntitySynchronizationInterceptor/interceptor interceptororg.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor/interceptor - interceptororg.jboss.ejb.plugins.cmp.jdbc.JDBCReadAheadInterceptor/interceptor /container-interceptors instance-poolorg.jboss.ejb.plugins.EntityInstancePool/instance-pool instance-cacheorg.jboss.ejb.plugins.EntityInstanceCache/instance-cache @@ -120,7 +119,6 @@ interceptororg.jboss.ejb.plugins.EntityInstanceInterceptor/interceptor interceptororg.jboss.ejb.plugins.EntitySynchronizationInterceptor/interceptor interceptororg.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor/interceptor - interceptororg.jboss.ejb.plugins.cmp.jdbc.JDBCReadAheadInterceptor/interceptor /container-interceptors instance-poolorg.jboss.ejb.plugins.EntityInstancePool/instance-pool instance-cacheorg.jboss.ejb.plugins.EntityInstanceCache/instance-cache ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneUnidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:24 Modified:src/main/org/jboss/test/cmp2/relationship/oneToOneUnidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.2 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneUnidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneUnidirectional/ABTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ABTest.java 2001/12/11 02:17:59 1.1 +++ ABTest.java 2002/01/16 00:02:24 1.2 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToManyBidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:24 Modified:src/main/org/jboss/test/cmp2/relationship/oneToManyBidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.3 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToManyBidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToManyBidirectional/ABTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ABTest.java 2001/12/27 17:46:54 1.2 +++ ABTest.java 2002/01/16 00:02:24 1.3 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyBidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:23 Modified:src/main/org/jboss/test/cmp2/relationship/manyToManyBidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.3 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyBidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyBidirectional/ABTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ABTest.java 2001/12/27 17:46:28 1.2 +++ ABTest.java 2002/01/16 00:02:23 1.3 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToOneUnidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:24 Modified:src/main/org/jboss/test/cmp2/relationship/manyToOneUnidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.3 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToOneUnidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToOneUnidirectional/ABTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ABTest.java 2001/12/27 17:46:50 1.2 +++ ABTest.java 2002/01/16 00:02:23 1.3 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneBidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:24 Modified:src/main/org/jboss/test/cmp2/relationship/oneToOneBidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.2 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneBidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/oneToOneBidirectional/ABTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ABTest.java 2001/12/11 02:17:59 1.1 +++ ABTest.java 2002/01/16 00:02:24 1.2 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyUnidirectional ABTest.java
User: dsundstrom Date: 02/01/15 16:02:23 Modified:src/main/org/jboss/test/cmp2/relationship/manyToManyUnidirectional ABTest.java Log: Added a static suite method to each test, so tests can be run independently. Revision ChangesPath 1.3 +6 -0 jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyUnidirectional/ABTest.java Index: ABTest.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/relationship/manyToManyUnidirectional/ABTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ABTest.java 2001/12/27 17:46:41 1.2 +++ ABTest.java 2002/01/16 00:02:23 1.3 @@ -3,10 +3,16 @@ import java.util.Collection; import java.util.Iterator; import javax.naming.InitialContext; +import junit.framework.Test; import junit.framework.TestCase; import net.sourceforge.junitejb.EJBTestCase; +import org.jboss.test.JBossTestCase; public class ABTest extends EJBTestCase { + + public static Test suite() throws Exception { + return JBossTestCase.getJ2eeSetup(ABTest.class, cmp2-relationship.jar); + } public ABTest(String name) { super(name); ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/cmp2/ejbselect B.java BBean.java BHome.java EJBSelectUnitTestCase.java
User: dsundstrom Date: 02/01/15 16:05:04 Modified:src/main/org/jboss/test/cmp2/ejbselect B.java BBean.java BHome.java EJBSelectUnitTestCase.java Log: Added some methods to help with read ahead testing. Revision ChangesPath 1.2 +2 -0 jbosstest/src/main/org/jboss/test/cmp2/ejbselect/B.java Index: B.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/ejbselect/B.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- B.java2001/12/21 18:44:05 1.1 +++ B.java2002/01/16 00:05:04 1.2 @@ -6,6 +6,8 @@ public String getId(); +public String getName(); + public A getA(); public void setA(A a); 1.2 +7 -2 jbosstest/src/main/org/jboss/test/cmp2/ejbselect/BBean.java Index: BBean.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/ejbselect/BBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BBean.java2001/12/21 18:44:05 1.1 +++ BBean.java2002/01/16 00:05:04 1.2 @@ -6,16 +6,21 @@ public abstract class BBean implements EntityBean { -public String ejbCreate(String id) { +public String ejbCreate(String id, String name) { setId(id); +setName(name); return null; } -public void ejbPostCreate(String id) { } +public void ejbPostCreate(String id, String name) { } public abstract String getId(); public abstract void setId(String id); + +public abstract String getName(); + +public abstract void setName(String name); public abstract A getA(); 1.2 +1 -1 jbosstest/src/main/org/jboss/test/cmp2/ejbselect/BHome.java Index: BHome.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/ejbselect/BHome.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- BHome.java2001/12/21 18:44:05 1.1 +++ BHome.java2002/01/16 00:05:04 1.2 @@ -6,7 +6,7 @@ public interface BHome extends EJBLocalHome { -public B create(String id) throws CreateException; +public B create(String id, String name) throws CreateException; public B findByPrimaryKey(String id) throws FinderException; 1.2 +17 -5 jbosstest/src/main/org/jboss/test/cmp2/ejbselect/EJBSelectUnitTestCase.java Index: EJBSelectUnitTestCase.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/cmp2/ejbselect/EJBSelectUnitTestCase.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- EJBSelectUnitTestCase.java2001/12/21 18:44:05 1.1 +++ EJBSelectUnitTestCase.java2002/01/16 00:05:04 1.2 @@ -50,16 +50,28 @@ a = ahome.create(A1); Collection bs = a.getBs(); - bs.add(bhome.create(B1)); - bs.add(bhome.create(B2)); - bs.add(bhome.create(B3)); - bs.add(bhome.create(B4)); + bs.add(bhome.create(B1, Alice)); + bs.add(bhome.create(B2, Bob)); + bs.add(bhome.create(B3, Charlie)); + bs.add(bhome.create(B4, Dan)); } public void testReturnedInterface() throws Exception { Iterator i = a.getSomeBs().iterator(); while(i.hasNext()) { - assertTrue(i.next() instanceof B); + Object obj = i.next(); + assertTrue(obj instanceof B); + B b = (B) obj; + b.getName(); + } + + + i = a.getSomeBs().iterator(); + while(i.hasNext()) { + Object obj = i.next(); + assertTrue(obj instanceof B); + B b = (B) obj; + b.getName(); } } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/resources/cmp2/ejbselect/META-INF ejb-jar.xml
User: dsundstrom Date: 02/01/15 16:07:46 Modified:src/resources/cmp2/ejbselect/META-INF ejb-jar.xml Log: Added name cmp field. Revision ChangesPath 1.2 +1 -0 jbosstest/src/resources/cmp2/ejbselect/META-INF/ejb-jar.xml Index: ejb-jar.xml === RCS file: /cvsroot/jboss/jbosstest/src/resources/cmp2/ejbselect/META-INF/ejb-jar.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ejb-jar.xml 2001/12/21 18:42:51 1.1 +++ ejb-jar.xml 2002/01/16 00:07:46 1.2 @@ -49,6 +49,7 @@ cmp-version2.x/cmp-version abstract-schema-nameB/abstract-schema-name cmp-fieldfield-nameid/field-name/cmp-field + cmp-fieldfield-namename/field-name/cmp-field primkey-fieldid/primkey-field /entity /enterprise-beans ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/resources/cmp2/relationship/META-INF jbosscmp-jdbc.xml
User: dsundstrom Date: 02/01/15 16:20:35 Modified:src/resources/cmp2/relationship/META-INF jbosscmp-jdbc.xml Log: Set test to use read ahead on find. Revision ChangesPath 1.2 +2 -1 jbosstest/src/resources/cmp2/relationship/META-INF/jbosscmp-jdbc.xml Index: jbosscmp-jdbc.xml === RCS file: /cvsroot/jboss/jbosstest/src/resources/cmp2/relationship/META-INF/jbosscmp-jdbc.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jbosscmp-jdbc.xml 2001/12/11 02:12:05 1.1 +++ jbosscmp-jdbc.xml 2002/01/16 00:20:35 1.2 @@ -9,7 +9,8 @@ defaults create-tabletrue/create-table remove-tabletrue/remove-table - relation-mapping-styleforeign-key/relation-mapping-style + pk-constrainttrue/pk-constraint + read-aheadstrategyon-find/strategy/read-ahead /defaults relationships ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: contrib/jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java
User: jules_gosnell Date: 02/01/15 16:36:51 Modified:jetty/src/main/org/jboss/jetty/session AbstractDistributedStore.java ClusteredStore.java CoarseDistributedStore.java DistributedHttpSession.java DistributedHttpSessionManager.java Log: prepare to hook ClusteredHTTPSession support to DistributedHttpSession. Revision ChangesPath 1.2 +4 -4 contrib/jetty/src/main/org/jboss/jetty/session/AbstractDistributedStore.java Index: AbstractDistributedStore.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/AbstractDistributedStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractDistributedStore.java 2002/01/14 22:25:18 1.1 +++ AbstractDistributedStore.java 2002/01/16 00:36:51 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: AbstractDistributedStore.java,v 1.1 2002/01/14 22:25:18 jules_gosnell Exp $ +// $Id: AbstractDistributedStore.java,v 1.2 2002/01/16 00:36:51 jules_gosnell Exp $ // @@ -24,8 +24,8 @@ { public String nextId(); public AbstractHttpSessionData make(); - public AbstractHttpSessionData get(String id); - public void set(String id, AbstractHttpSessionData data); - //public void remove(String id); + public AbstractHttpSessionData get(String id, boolean delete); + public void put(String id, AbstractHttpSessionData data); + public void remove(String id); public boolean isValid(); } 1.2 +143 -10 contrib/jetty/src/main/org/jboss/jetty/session/ClusteredStore.java Index: ClusteredStore.java === RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/jboss/jetty/session/ClusteredStore.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ClusteredStore.java 2002/01/14 22:25:18 1.1 +++ ClusteredStore.java 2002/01/16 00:36:51 1.2 @@ -5,7 +5,7 @@ * See terms of license at gnu.org. */ -// $Id: ClusteredStore.java,v 1.1 2002/01/14 22:25:18 jules_gosnell Exp $ +// $Id: ClusteredStore.java,v 1.2 2002/01/16 00:36:51 jules_gosnell Exp $ // @@ -13,6 +13,98 @@ // +import org.jboss.logging.Logger; +import java.util.Map; + +// + +class + ClusteredHttpSessionData + implements AbstractHttpSessionData, java.io.Serializable +{ + String _id; + long_creationTime; + long_lastAccessedTime; + int _maxInactiveInterval; + Map _attributes; + boolean _attributesWerePassivated; + + // from javax.servlet.http.HttpSession + public long +getCreationTime() +{ + return _creationTime; +} + + public String +getId() +{ + return _id; +} + + public long +getLastAccessedTime() +{ + return _lastAccessedTime; +} + + public int +getMaxInactiveInterval() +{ + return _maxInactiveInterval; +} + + public void +setMaxInactiveInterval(int maxInactiveInterval) +{ + _maxInactiveInterval=_maxInactiveInterval; +} + + // extra accessors + public Map +getAttributes() +{ + return _attributes; +} + + public void +setAttributes(Map attributes) +{ + _attributes=attributes; +} + + public void +setId(String id) +{ + _id=id; +} + + public void +setCreationTime(long creationTime) +{ + _creationTime=creationTime; +} + + public void +setLastAccessedTime(long lastAccessedTime) +{ + _lastAccessedTime=lastAccessedTime; +} + + // extra attributes + public boolean +getAttributesWerePassivated() +{ + return _attributesWerePassivated; +} + + public void +setAttributesWerePassivated(boolean attributesWerePassivated) +{ + _attributesWerePassivated=attributesWerePassivated; +} +} + /** * An abstraction of a manager for the distributed store of HttpSessions * @@ -20,34 +112,51 @@ * @version 1.0 * @since 1.0 */ -abstract class +public class ClusteredStore + implements AbstractStore { - // ClusteredHTTPSessionServiceMBean _mbean; + final Logger _log=Logger.getLogger(getClass().getName()); + // final ClusteredHTTPSessionServiceMBean _mbean; public ClusteredStore() { + _log.info(CTOR); // lookup JMX service } - public String +// public
[JBoss-dev] jbossmq message transport times
As a start on measuring jbossmq performance, I timed sending and receiving a 1-kbyte nondurable mesage (in a loop to amortize JIT effects and the like). Both client and server were on the same machine. The average round trip time was 400 miliseconds, which is not good at all. Some investigation showed that most of the time was spent idling in the message transport code. I tried a few things and eventually discovered that explicitly setting TCPNODELAY on the sockets fixed the problem-- round trip times dropped down to a few tens of milliseconds. I can certainly submit a patch with the one-line change, but before I do-- is this really the right fix? Will it make something else worse? If no one else has seen the same problem, perhaps it's O/S specific. I'm testing on MacOS X, which for our purposes is just another Unix flavor with an oddball GUI. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Automated JBoss Testsuite Results
JBoss daily test results SUMMARY Number of tests run: 270 Successful tests: 267 Errors:1 Failures: 2 [time of test: 16 January 2002 2:53 GMT] [java.version: 1.3.0] [java.vendor: IBM Corporation] [java.vm.version: 1.3.0] [java.vm.name: Classic VM] [java.vm.info: J2RE 1.3.0 IBM build cx130-20010626 (JIT enabled: jitc)] [os.name: Linux] [os.arch: x86] [os.version: 2.4.9-12] See http://lubega.com for full details NOTE: If there are any errors shown above - this mail is only highlighting them - it is NOT indicating that they are being looked at by anyone. It is assumed that whoever makes change(s) to jboss that break the test will be fixing the test or jboss, as appropriate! DETAILS OF ERRORS [details not shown - as this makes the mail too big to reach the sf mailing list] PS BEFORE you commit, run the test suite. Its easy, just run the target 'run-basic-testsuite' from the main build.xml. PPS Come on people - there were a few days back in July 2001 when we had ZERO tests failing! Oh, and thanks - remember we love you too! ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Automated JBoss Testsuite Results
JBoss daily test results SUMMARY Number of tests run: 270 Successful tests: 268 Errors:1 Failures: 1 [time of test: 16 January 2002 3:22 GMT] [java.version: 1.3.1] [java.vendor: Blackdown Java-Linux Team] [java.vm.version: Blackdown-1.3.1-FCS] [java.vm.name: Java HotSpot(TM) Client VM] [java.vm.info: mixed mode] [os.name: Linux] [os.arch: i386] [os.version: 2.4.9-12] See http://lubega.com for full details NOTE: If there are any errors shown above - this mail is only highlighting them - it is NOT indicating that they are being looked at by anyone. It is assumed that whoever makes change(s) to jboss that break the test will be fixing the test or jboss, as appropriate! DETAILS OF ERRORS [details not shown - as this makes the mail too big to reach the sf mailing list] PS BEFORE you commit, run the test suite. Its easy, just run the target 'run-basic-testsuite' from the main build.xml. PPS Come on people - there were a few days back in July 2001 when we had ZERO tests failing! Oh, and thanks - remember we love you too! ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Automated JBoss Testsuite Results
JBoss daily test results SUMMARY Number of tests run: 270 Successful tests: 268 Errors:1 Failures: 1 [time of test: 16 January 2002 4:8 GMT] [java.version: 1.3.1] [java.vendor: Blackdown Java-Linux Team] [java.vm.version: Blackdown-1.3.1-FCS] [java.vm.name: Classic VM] [java.vm.info: green threads, nojit] [os.name: Linux] [os.arch: i386] [os.version: 2.4.9-12] See http://lubega.com for full details NOTE: If there are any errors shown above - this mail is only highlighting them - it is NOT indicating that they are being looked at by anyone. It is assumed that whoever makes change(s) to jboss that break the test will be fixing the test or jboss, as appropriate! DETAILS OF ERRORS [details not shown - as this makes the mail too big to reach the sf mailing list] PS BEFORE you commit, run the test suite. Its easy, just run the target 'run-basic-testsuite' from the main build.xml. PPS Come on people - there were a few days back in July 2001 when we had ZERO tests failing! Oh, and thanks - remember we love you too! ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] Automated JBoss Testsuite Results
JBoss daily test results SUMMARY Number of tests run: 270 Successful tests: 268 Errors:1 Failures: 1 [time of test: 16 January 2002 4:56 GMT] [java.version: 1.3.1] [java.vendor: Sun Microsystems Inc.] [java.vm.version: 1.3.1-b24] [java.vm.name: Java HotSpot(TM) Server VM] [java.vm.info: mixed mode] [os.name: Linux] [os.arch: i386] [os.version: 2.4.9-12] See http://lubega.com for full details NOTE: If there are any errors shown above - this mail is only highlighting them - it is NOT indicating that they are being looked at by anyone. It is assumed that whoever makes change(s) to jboss that break the test will be fixing the test or jboss, as appropriate! DETAILS OF ERRORS [details not shown - as this makes the mail too big to reach the sf mailing list] PS BEFORE you commit, run the test suite. Its easy, just run the target 'run-basic-testsuite' from the main build.xml. PPS Come on people - there were a few days back in July 2001 when we had ZERO tests failing! Oh, and thanks - remember we love you too! ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] need help
Who can tell mewhere can get the jboss-castorjdo.jar thanks micheal
[JBoss-dev] [ jboss-Bugs-504246 ] NULL and CMP field of primitive type
Bugs item #504246, was opened at 2002-01-15 23:52 You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=504246group_id=22866 Category: JBossCMP Group: v2.4 (stable) Status: Open Resolution: None Priority: 5 Submitted By: Alexei Yudichev (sflexus) Assigned to: Nobody/Anonymous (nobody) Summary: NULL and CMP field of primitive type Initial Comment: While loading entity in the case of CMP field of prvitive type and corresponding NULL database value java.lang.reflect.Field.set() throws NullPointerException like this: java.lang.NullPointerException at java.lang.reflect.Field.set(Native Method) at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPField Value(JDBCCommand.jav a:651) at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.l oadOneEntity(JDBCLoad EntityCommand.java:217) ... I suppose it should be wrapped by more informative exception with the message like cannot set the value CMP field of primitive type to NULL. -- You can respond by visiting: http://sourceforge.net/tracker/?func=detailatid=376685aid=504246group_id=22866 ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development