Re: removal aware list
Yes, I have a system with about 600 entities, several are M:N, and all are proxies. I can't reproduce either. I'm using 1.0.3. Regards, Richter Armin Waibel escreveu: Hi Dennis, Dennis Bekkering wrote: Richter, I use 1.04 and explicitly configured ojb not to use a RemovalAwareList. I explicitly configured ojb to use a ManageableArrayList. But still i get a RemovalAwareList out of the proxy class's getData method. I tried to reproduce your test (m:n reference + proxy) without success - I always get a ManageableArrayList instance. I'm using latest from SVN (OJB_1_0_RELEASE branch). Could you exactly describe how to reproduce your problem. regards, Armin regards, Dennis 2006/9/19, Edson Carlos Ericksson Richter < [EMAIL PROTECTED]>: As name said, it's a "Removal Aware". If you don't wish objects removed, don't use "RemovarAware". The default implementation is not "RemovalAwareList", so it's sufficient to remove the specific implementation on mapping. IT: some older versions of OJB used RemovalAwareList as default - so, please, if you are not using 1.0.3 or 1.0.4, upgrade your version (check mail list about changes that could affect your upgrade). Regards, Richter Dennis Bekkering escreveu: > Hello all, > > I have an M:N collection that has a ManageableArrayList as collection > class > and proxy set to true. But when the collection is materialized the > underlying implementation becomes RemovalAwareList. When i remove > items from > that list the records are also deleted. I tried to find out how that can > happen with the debugger but i cannot find out why. > > regards, > Dennis > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: removal aware list
As name said, it's a "Removal Aware". If you don't wish objects removed, don't use "RemovarAware". The default implementation is not "RemovalAwareList", so it's sufficient to remove the specific implementation on mapping. IT: some older versions of OJB used RemovalAwareList as default - so, please, if you are not using 1.0.3 or 1.0.4, upgrade your version (check mail list about changes that could affect your upgrade). Regards, Richter Dennis Bekkering escreveu: Hello all, I have an M:N collection that has a ManageableArrayList as collection class and proxy set to true. But when the collection is materialized the underlying implementation becomes RemovalAwareList. When i remove items from that list the records are also deleted. I tried to find out how that can happen with the debugger but i cannot find out why. regards, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deleting items in collection?
I've been using RemovalAwareList in the descriptor, so I don't need to take care of this in coding. Regards, Richter Carlos Chávez escreveu: Sebastian Stein escribió: Vasily Ivanov <[EMAIL PROTECTED]> [060821 23:46]: if I delete an ClassB object from the collection in ClassA and store the ClassA object again, this ClassB object is not removed from the database It depends on how you delete this object from collection. You should get object (aObject) with all references using OJB query, first. Than remove object (bObject) from collection (by calling aObject.getBs().remove(bObject)) and than call broker.store(aObject). That should remove bObject from db. I really don't understand why it is not working. I do the following: aObject.getBs().clear(); aObject.getBs().addAll(newBs); But the old Bs are not removed, just the new Bs are added. This is the case if I have auto-delete="false" in the repository.xml for the definition of the objectB collection. If I turn it on, it deletes all Bs without adding them again. It is very strange. Hi Sebastian. We had some similar situation, we solved in this way: OBJ have a RemovalAwareList class, so i create a List usign RemovalAwareList(), copy the childs to this list, then remove the object from the list then i commit the changes. Example: List lst = new RemovalAwareList(); lst.addAll(object1.getChilds()); lst.remove(child); object1.setChilds(lst); So when you commit your changes OJB delete the object. I hope this help. Cheers, Carlos Chávez. Sebastian PS: If you are interested I can also point you directly to the code, it is public. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: Info: Geänderte Mail-Adresse / C hanged email-Address]
Please, guys, kick off this guy from the list! Regards, Richter Mensagem original Assunto:Info: Geänderte Mail-Adresse / Changed email-Address Data: Tue, 1 Aug 2006 15:15:05 +0200 De: [EMAIL PROTECTED] Para: Edson Carlos Ericksson Richter <[EMAIL PROTECTED]> Sehr geehrte Damen und Herren, die e-Mail-Adressen der Westfälischen Provinzial Versicherung haben sich geändert. Die Domäne lautet statt "@provinzial-online.de" nun "@provinzial.de". Die neue e-mail-Adresse eines Adressaten der Westfälischen Provinzial lautet: [EMAIL PROTECTED] Bitte verwenden Sie in Zukunft die neue Adresse, die im Anhang aufgeführt ist. Ihre nach der alten Namenskonvention adressierte Mail wurde an den Adressaten weitergeleitet. Mit freundlichen Grüßen Ihre Provinzial Anhang: --- Alte Adresse / Neue Adresse '[EMAIL PROTECTED]' --> '[EMAIL PROTECTED]' - Diese Mail ist allein fuer den / die bezeichneten Adressaten bestimmt. Sie kann rechtlich vertrauliche Informationen enthalten. Wenn Sie dieses Mail irrtuemlich erhalten haben, informieren Sie bitte den Absender und loeschen Sie diese Nachricht von Ihrem Computer. Vielen Dank. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB hang
Unique case I've found OJB hang is because of unfinalized transactions (so it's a database problem, not OJB ones). I had situations where I query tables with almost 1 milion records, without problem (I've used MaxDB, on linux and windows, MsSQL, on windows and Oracle 10g on linux and windows). Of course, you should check: 1) There are pending transactions on your database 2) What is your database strategy for queries (read uncommited, read commited, etc) 3) If there are sufficient memory allocated to Virtual Machine (parameter -Xmx1024m by example, that alocates 1GB for program execution. Default for VM is 64M) Could you share what database you uses, what amount of memory and how large is table you are using? May be you should use a pagination strategy (so you don't load every record from database - only his PKs, then load records as needed, in demand). Regards, Richter Feng Qiang escreveu: Hello everyone, I am using ojb 1.0.4 in weblogic 8.1.5 on HP unix, I use ojb to retrieve data from a database view. However, when record is few, the retrieve is OK. But if the record is bigger, ojb will hang. My retrieval is like this: ReportQueryByCriteria query = QueryFactory.newReportQuery(ShipmentViewImpl.class, crit); Iterator iter = broker.getReportQueryIteratorByQuery(query); The query will hang at the getReportQueryIteratorByQuery() statement. Anyone can give me any suggestion to solve this problem. Best Regards Feng Qiang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bug in OJB 1.0.3 (MS SQL violation constraint on cascaded table)
No news if this is confirmed against 1.0.4? Richter Edson Carlos Ericksson Richter escreveu: Hi! I discovered an interesting (bug?) behaviour in OJB 1.0.3. I am using auto-commit false for every connection. When I store an object that has an list with cascade all, but one object in the list fail to store, then I got "Primary Key violation - attempt to insert duplicate key on PRIMARY_TABLE" (where PRIMARY_TABLE is table name of object I asked to store). I don't know why OJB is trying to insert object twice (insert main object with newly generated value, insert child object with error, try to insert main object again but with value already defined, causing PK violation) when error occured, but it is. Since my object is auto-numbered, first attemp it get one value from sequence (procedure), second attemp, since object already has key defined, it tries to just insert, causing duplicate key. I don't know if it was clear, but this is what is happening. Thanks, Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: Returned mail: see transcript for details]
Could list admin kick off this guy? His mail doesn't exists anymore, and every time I send mails to the list I get auto-response saying "domain changed"... Richter Mensagem original Assunto:Returned mail: see transcript for details Data: Fri, 2 Jun 2006 14:45:40 -0300 De: Mail Delivery Subsystem <[EMAIL PROTECTED]> Para: <[EMAIL PROTECTED]> The original message was received at Fri, 2 Jun 2006 14:44:34 -0300 from 201-3-142-84.nhoce7005.dsl.brasiltelecom.net.br [201.3.142.84] (may be forged) - The following addresses had permanent fatal errors - <[EMAIL PROTECTED]> (reason: 550 Mailbox unavailable or access denied - <[EMAIL PROTECTED]>) - Transcript of session follows - ... while talking to smtp.provinzial-online.de.: RCPT To:<[EMAIL PROTECTED]> <<< 550 Mailbox unavailable or access denied - <[EMAIL PROTECTED]> 550 5.1.1 <[EMAIL PROTECTED]>... User unknown Reporting-MTA: dns; adsl.plugin.com.br Received-From-MTA: DNS; 201-3-142-84.nhoce7005.dsl.brasiltelecom.net.br Arrival-Date: Fri, 2 Jun 2006 14:44:34 -0300 Final-Recipient: RFC822; vorname.nachname@provinzial.de Action: failed Status: 5.1.1 Remote-MTA: DNS; smtp.provinzial-online.de Diagnostic-Code: SMTP; 550 Mailbox unavailable or access denied - Last-Attempt-Date: Fri, 2 Jun 2006 14:45:40 -0300 --- Begin Message --- Hi! All the time I send one e-mail to OJB users mail list, I get a response about your domain change. Could you please update your mail address on OJB users mail list so we don't receive this boring message again? Richter begin:vcard fn:Edson Carlos Ericksson Richter n:Richter;Edson org;quoted-printable:MGR Inform=C3=A1tica Ltda;Desenvolvimento adr:Cristo Redentor;;Assis Brasil, 3257, Sala 409;Porto Alegre;RS;91010007;Brasil email;internet:[EMAIL PROTECTED] title:Diretor de Sistemas tel;work:(51)3347-0446 tel;cell:(51)9259-2993 x-mozilla-html:FALSE url:http://www.mgrinformatica.com.br version:2.1 end:vcard --- End Message --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bug in OJB 1.0.3 (MS SQL violation constraint on cascaded table)
Hi! I discovered an interesting (bug?) behaviour in OJB 1.0.3. I am using auto-commit false for every connection. When I store an object that has an list with cascade all, but one object in the list fail to store, then I got "Primary Key violation - attempt to insert duplicate key on PRIMARY_TABLE" (where PRIMARY_TABLE is table name of object I asked to store). I don't know why OJB is trying to insert object twice (insert main object with newly generated value, insert child object with error, try to insert main object again but with value already defined, causing PK violation) when error occured, but it is. Since my object is auto-numbered, first attemp it get one value from sequence (procedure), second attemp, since object already has key defined, it tries to just insert, causing duplicate key. I don't know if it was clear, but this is what is happening. Thanks, Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error in beginTransaction!
I don't know if this affects you, but I have serious trouble with maxIdle < 2... So I always set it to 2 or greather... Since you configured to use TestOnBorrow, check query you are using to make this test. I use something like "select 1 from DUAL" in Oracle databases, and "select 1" in MS SQL. I don't know what you can do in MySQL, but choose one very fast, because it could has heavy impact on your app later... Olá! Marcel, eu trabalho com o OJB a uns 4 anos... e não tenho problemas com beginTransaction. Porém, com o SapDB, notadamente, eu tinha problemas para obter conexões se eu deixasse o parametro maxIdle = 1 ou maxIdle = 0... E o SapDB também tinha o péssimo hábito de fechar minhas conexões e não re-abrí-las. Então, eu sempre usei maxIdle = 2, e TestOnBorrow=true e ainda a query que eu usava para o teste (que não ví na tua configuração) era "select 1 from DUAL", e no MS SQL é simplesmente "select 1". Eu até tinha esquecido deste parametro (maxIdle), e não mudei quando migrei de SapDB para Oracle e posteriormente para MS SQL... Espero que isto ajude. Richter Marcel Souza escreveu: Hello folks, I am stucked in a problem using OJB. I am trying to use MySQL and OJB but it always happens an error during broker.beginTransaction() that says "Can't lookup a connection". Anyone has a sugestion to solve it??? Thanks in advance, Marcel. 15:33:01,390 INFO [ObjectCacheFactory] Start creating new ObjectCache instance 15:33:01,390 INFO [ObjectCacheFactory] Default ObjectCache class was org.apache .ojb.broker.cache.ObjectCacheDefaultImpl 15:33:01,390 INFO [CacheDistributor] Use property 'descriptorBasedCaches' is se t 'false' 15:33:01,390 INFO [ObjectCacheFactory] Instantiate new org.apache.ojb.broker.ca che.CacheDistributor class object 15:33:01,390 INFO [ObjectCacheFactory] New ObjectCache instance was created 15:33:01,390 INFO [ConnectionFactoryPooledImpl] Create new connection pool:org. [EMAIL PROTECTED] jcd-alias=mysql default-connection=false dbms=MySQL jdbc-level=2.0 driver=com.mysql.jdbc.Driver protocol=jdbc sub-protocol=mysql db-alias=//localhost:3306/lportal user=root password=* eager-release=false ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=21, max Wait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, testWhileIdle=false , minEvictableIdleTimeMillis=60, testOnReturn=false, logAbandoned=false, rem oveAbandonedTimeout=300, timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} batchMode=false useAutoCommit=AUTO_COMMIT_SET_TRUE_AND_TEMPORARY_FALSE ignoreAutoCommitExceptions=false sequenceDescriptor= ] 15:33:01,390 INFO [STDOUT] javax.portlet.PortletException: Erro DoViewPadrao - Can't lookup a connection - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoiding Persistence Broker Leak
I've used a similar solution, but when I get a broker, first I check if one broker was already taken for this thread (and a usage counter is incremented). Then, when I start one operation, I just check if there is not already a transaction. If there is no transaction, then I open one. Finally, when I ask to close the broker, a usage counter for current thread is decremented, and if it's zero, then broker is really closed. This technique allow: - Cross object transactions in same thread - Avoid begin more than one transaction per broker - Obligate to always open one transaction, what guarantee standard behaviour independent of developer personal preferences (important for groups). So, I can reuse a component written by another programmer because I know if he execute some operation in database, I'll be in same transaction. - When no more object is using a broker, the broker is automatically closed. Resuming, all my code finish in one class that is responsible to take a broker, start a transaction (if needed), execute operation, and close broker (if there is no more objects using it, of course). When I execute one operation, I delegate to Action method to start transaction, commit or rollback. So, every action in my code has following structure: public void actionPerformed(ActionEvent evt) { try { MyPersonBrokerUC.beginTransaction(); // starts a transaction and increments usage (to 1) for this thread MyPersonBrokerUC.store(somePerson); // detect if is a insert or an update (increments usage to 2) and does the job (return broker and decrements to 1 again). Will use same broker and transaction started above OtherPersonUC.dealWithNewPersons(somePerson); // will run under same transaction (increments usage to 2, execute operation, and decrements to 1 again). I don't even need to know if there is a bunch of another calls inside this method: all will run under same transaction. MyPersonBrokerUC.commitTransaction(); // commit the transaction and decrements usage (to 0, so broker is really closed) } catch(Exception e) { MyPersonBrokerUC.rollbackTransaction(); // rollback the transaction and decrements usage (to 0, so broker is really closed) DebugUtil.handleException(e); } } UC (use cases) classes never begin, commit or rollback: it's a Action task. Because a task always execute under unique thread, there is not problems (if you wish to execute async operation, just start transaction inside new thread). Works for MVC-Web development (a Servlet or a JSP will be the "action" in this case). Thanks to try...catch structure, there is no way to forget a broker open, neither a transaction open. Only one cons for this: when debugging, don't try to "fix and continue", because you will get broken brokers and transactions, leading to dead lock and fatally to stop and restart. OT: humm, trying to explain just in words this appear to be really complicated, but in fact, it isn't. May be sometime I get spare time to create some nice Sequence and Collaboration diagrams to explain this Best regards, Edson Richter Bruno CROS escreveu: Hi Armin, Thanks for the idea to detect broker leak. It will show some bad coded methods, even they have been checked : commit never reached, broker not closed... no commit/abort !!! (find one, arghh ) Meanwhile, there was still some "open broker detected". When i look into code, i found some old methods that were reading objects, with a dedicated transaction. I known now that this transaction is not necessary, and I know now it's even unwanted ! It seems to burn connections/brokers. So i add a little check to my "getTransaction()" method. Now, it searches for a current transaction, and il found, throw a "Already open transaction". This let us detect the standalone update method (opening and closing Transaction), who are called inside an already open Transaction (as the old bad reads methods was called by update methods). Everything gets ok now. May be it can be an developpment setup to avoid broker leak due to the double opening Transaction (with same broker) Thanks a lot. Again. Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Procedure based sequencence generator repeating values (SOLVED)
Ok, this really solved. Final procedure code (works on SQL2K and SQL2K5): CREATE PROCEDURE OJB_NEXTVAL_PROC @SEQ_NAME varchar(150) AS declare @MAX_KEY BIGINT set nocount off set @MAX_KEY = 0 UPDATE OJB_NEXTVAL_SEQ SET @MAX_KEY = MAX_KEY = MAX_KEY + 1 WHERE SEQ_NAME = @SEQ_NAME -- return an error if -- sequence does not exist -- so we will know if someone -- truncates the table if @MAX_KEY = 0 RAISERROR ('Sequence %s does not exists!', 16, 1, @SEQ_NAME) else select @MAX_KEY RETURN @MAX_KEY I changed from SELECT 1/0 because "Division by zero error" (what procedure is giving the error?!?) is not so intuitive as "Sequence SQ_PERSON_ID does not exists!" (huh, that sequence is missing!). And don't forget to add to every trigger you write: on begginning of the trigger:SET NOCOUNT On on finish of the trigger: SET NOCOUNT Off Put your database in full recovery model, so you have transactional behaviour control (on simple recovery model things works badly - I'm a MS certified SQL professional, but I don't understand why it's not working: it should be!). And finally, put your app under useAutoCommit="2" (on jdbc-connection descriptor, this means "always set autoCommit(false) when open connection" - don't forget, your app became responsible to BeginTransactions and to CommitTransactions, otherwise they will be rolled back). This solved all my transactional problems when using PB API with SQL Server 2K + Service Pack 4 (SP4 is very important for this scenario - look bellow). History of status for each service pack: 1) With SP2, transactional problems are sparse: from times to times, got deadlock in database due very large views (!) 2) With SP3, transactional problems came frequent. Almost every operational with large tables lead to deadlocks. Performance came terrible (even when there is no deadlock). This two new "features" from SP3 made app almost ununsable. 3) With SP4, transactional problems are sparse, but autonumeration stop to work. Then above statements where executed (corrections on procedure and triggers), and in "useAutoCommit" attribute, plus SQL Server in full recovery model solved. Now, SQL Server is stable, running 3 medium sized databases (one for VB app, one for pure Servlets/JSP app, and one for a Swing/OJB app), each with about 1Gb of data. Thanks to you all, I expect this report helps anyone trying to work with SQL Server + OJB + autonumbering + several simultaneous users + heavy transactional control under PB API. Richter Edson Carlos Ericksson Richter escreveu: Ok, guys. I think I discovered a piece of solution for this problem: 1) Database must be in Full recovery model 2) Every trigger must start with SET NOCOUNT ON and end with SET NOCOUNT OFF 3) The OBJ_NEXTVAL_PROC should start with SET NOCOUNT OFF We are in testing fase right now, but appear the problem is solved. Thanks for tips (special do Armin, who was unique to respond :( ). I'll let you know (during next week) if this really solved. If so, I'll ask to add this notes to documentation, to avoid hours of reserach to others in future. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Procedure based sequencence generator repeating values (MAYBE SOLVED)
Ok, guys. I think I discovered a piece of solution for this problem: 1) Database must be in Full recovery model 2) Every trigger must start with SET NOCOUNT ON and end with SET NOCOUNT OFF 3) The OBJ_NEXTVAL_PROC should start with SET NOCOUNT OFF We are in testing fase right now, but appear the problem is solved. Thanks for tips (special do Armin, who was unique to respond :( ). I'll let you know (during next week) if this really solved. If so, I'll ask to add this notes to documentation, to avoid hours of reserach to others in future. Best regards, Edson Richter Edson Carlos Ericksson Richter escreveu: Ok, guys: now, I'm lost! I changed auto-commit from 1 to 2, and now, appear OJB is trying to insert records twice - on every new object I store, I get primary key violation! I'm using PB API with MsSQL Server 2000 SP4 and JDBC Driver for MS SQL Server 2005 latest release. Someone knows what is going on? Any tips, please!!! Richter Edson Carlos Ericksson Richter escreveu: Hi! I'm still with this problem. Could someone say if SequenceManagers use default connection present at current thread? Or it's executed inside same transaction (I don't know if this implies same connection)? Thanks for any clarifications! Richter Edson Carlos Ericksson Richter escreveu: Armin Waibel escreveu: Hi, I'm not a database expert, so please forbear with me ;-) Edson Carlos Ericksson Richter wrote: Hi! There is a very long time since my last problem with OJB - thank you guys, it's awesome how good work was done until now. In last month, I was migrating from Oracle to MS SQL, and changed from Sequence Manager Oracle native to Procedure based on MS SQL. Worked great on tests, but when in production, sometimes procedure returns same value for two users, overriding content of child tables (it override child tables, then throw duplicate primary key exception for parent table but changes on child tables are not being rolled back). Are you sure that the changes written to database or could it be a caching problem? Well, independent of being a cache problem, I gettin records overwritten, what is bad per se. I'm sure I'm beginning and rollbacking transactions, and opening and closing connections (i never had this problem with Oracle, by example). Did you made concurrency tests against SequenceManagerStoredProcedureImpl? In OJB test-suite you can find a test case called SequenceManagerTest. This test case include concurrency sequence generation tests. Is the issue reproduceable via unit tests? No, I've made no tests... I tried community before (withou much luck, until now :D ) In SequenceManagerStoredProcedureImpl source code I can't find critical sections. So I assume it's a MSSQL concurrency problem. Does UPDATE OJB_NEXTVAL_SEQ... exclusive lock the table row? Well, I was supposing it is. But after reading SP4 fixlist for SQL2000, I start having doubts... So, I'll try to increase to REPETEABLE READ as default transaction level, and see what happens (god save our souls, because REPETEABLE READ almost always gives problems of deadlocking with SQL Server). I appreciate your comments, and I'll expect sequence gerenator author give some comments (I really appreciate if thats possible)... Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Procedure based sequencence generator repeating values
Ok, guys: now, I'm lost! I changed auto-commit from 1 to 2, and now, appear OJB is trying to insert records twice - on every new object I store, I get primary key violation! I'm using PB API with MsSQL Server 2000 SP4 and JDBC Driver for MS SQL Server 2005 latest release. Someone knows what is going on? Any tips, please!!! Richter Edson Carlos Ericksson Richter escreveu: Hi! I'm still with this problem. Could someone say if SequenceManagers use default connection present at current thread? Or it's executed inside same transaction (I don't know if this implies same connection)? Thanks for any clarifications! Richter Edson Carlos Ericksson Richter escreveu: Armin Waibel escreveu: Hi, I'm not a database expert, so please forbear with me ;-) Edson Carlos Ericksson Richter wrote: Hi! There is a very long time since my last problem with OJB - thank you guys, it's awesome how good work was done until now. In last month, I was migrating from Oracle to MS SQL, and changed from Sequence Manager Oracle native to Procedure based on MS SQL. Worked great on tests, but when in production, sometimes procedure returns same value for two users, overriding content of child tables (it override child tables, then throw duplicate primary key exception for parent table but changes on child tables are not being rolled back). Are you sure that the changes written to database or could it be a caching problem? Well, independent of being a cache problem, I gettin records overwritten, what is bad per se. I'm sure I'm beginning and rollbacking transactions, and opening and closing connections (i never had this problem with Oracle, by example). Did you made concurrency tests against SequenceManagerStoredProcedureImpl? In OJB test-suite you can find a test case called SequenceManagerTest. This test case include concurrency sequence generation tests. Is the issue reproduceable via unit tests? No, I've made no tests... I tried community before (withou much luck, until now :D ) In SequenceManagerStoredProcedureImpl source code I can't find critical sections. So I assume it's a MSSQL concurrency problem. Does UPDATE OJB_NEXTVAL_SEQ... exclusive lock the table row? Well, I was supposing it is. But after reading SP4 fixlist for SQL2000, I start having doubts... So, I'll try to increase to REPETEABLE READ as default transaction level, and see what happens (god save our souls, because REPETEABLE READ almost always gives problems of deadlocking with SQL Server). I appreciate your comments, and I'll expect sequence gerenator author give some comments (I really appreciate if thats possible)... Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Procedure based sequencence generator repeating values
Hi! I'm still with this problem. Could someone say if SequenceManagers use default connection present at current thread? Or it's executed inside same transaction (I don't know if this implies same connection)? Thanks for any clarifications! Richter Edson Carlos Ericksson Richter escreveu: Armin Waibel escreveu: Hi, I'm not a database expert, so please forbear with me ;-) Edson Carlos Ericksson Richter wrote: Hi! There is a very long time since my last problem with OJB - thank you guys, it's awesome how good work was done until now. In last month, I was migrating from Oracle to MS SQL, and changed from Sequence Manager Oracle native to Procedure based on MS SQL. Worked great on tests, but when in production, sometimes procedure returns same value for two users, overriding content of child tables (it override child tables, then throw duplicate primary key exception for parent table but changes on child tables are not being rolled back). Are you sure that the changes written to database or could it be a caching problem? Well, independent of being a cache problem, I gettin records overwritten, what is bad per se. I'm sure I'm beginning and rollbacking transactions, and opening and closing connections (i never had this problem with Oracle, by example). Did you made concurrency tests against SequenceManagerStoredProcedureImpl? In OJB test-suite you can find a test case called SequenceManagerTest. This test case include concurrency sequence generation tests. Is the issue reproduceable via unit tests? No, I've made no tests... I tried community before (withou much luck, until now :D ) In SequenceManagerStoredProcedureImpl source code I can't find critical sections. So I assume it's a MSSQL concurrency problem. Does UPDATE OJB_NEXTVAL_SEQ... exclusive lock the table row? Well, I was supposing it is. But after reading SP4 fixlist for SQL2000, I start having doubts... So, I'll try to increase to REPETEABLE READ as default transaction level, and see what happens (god save our souls, because REPETEABLE READ almost always gives problems of deadlocking with SQL Server). I appreciate your comments, and I'll expect sequence gerenator author give some comments (I really appreciate if thats possible)... Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Procedure based sequencence generator repeating values
Armin Waibel escreveu: Hi, I'm not a database expert, so please forbear with me ;-) Edson Carlos Ericksson Richter wrote: Hi! There is a very long time since my last problem with OJB - thank you guys, it's awesome how good work was done until now. In last month, I was migrating from Oracle to MS SQL, and changed from Sequence Manager Oracle native to Procedure based on MS SQL. Worked great on tests, but when in production, sometimes procedure returns same value for two users, overriding content of child tables (it override child tables, then throw duplicate primary key exception for parent table but changes on child tables are not being rolled back). Are you sure that the changes written to database or could it be a caching problem? Well, independent of being a cache problem, I gettin records overwritten, what is bad per se. I'm sure I'm beginning and rollbacking transactions, and opening and closing connections (i never had this problem with Oracle, by example). Did you made concurrency tests against SequenceManagerStoredProcedureImpl? In OJB test-suite you can find a test case called SequenceManagerTest. This test case include concurrency sequence generation tests. Is the issue reproduceable via unit tests? No, I've made no tests... I tried community before (withou much luck, until now :D ) In SequenceManagerStoredProcedureImpl source code I can't find critical sections. So I assume it's a MSSQL concurrency problem. Does UPDATE OJB_NEXTVAL_SEQ... exclusive lock the table row? Well, I was supposing it is. But after reading SP4 fixlist for SQL2000, I start having doubts... So, I'll try to increase to REPETEABLE READ as default transaction level, and see what happens (god save our souls, because REPETEABLE READ almost always gives problems of deadlocking with SQL Server). I appreciate your comments, and I'll expect sequence gerenator author give some comments (I really appreciate if thats possible)... Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Procedure based sequencence generator repeating values
Hi! There is a very long time since my last problem with OJB - thank you guys, it's awesome how good work was done until now. In last month, I was migrating from Oracle to MS SQL, and changed from Sequence Manager Oracle native to Procedure based on MS SQL. Worked great on tests, but when in production, sometimes procedure returns same value for two users, overriding content of child tables (it override child tables, then throw duplicate primary key exception for parent table but changes on child tables are not being rolled back). I'm sure I'm beginning and rollbacking transactions, and opening and closing connections (i never had this problem with Oracle, by example). I was thinking if the problem wasn't default transaction level for MS SQL being different from Oracle (and MaxDB, that I used before getting in nervous with constant crashes/bad performance...). Someone has faced similar problems? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anyone using Generics?
I'm just migrating a quite large app (about 300Kloc) to 1.5 and focus is using generics. In our case, app was split in several (6) layers, one is specialized in persistence. So, we make persistence layer return generyfied collections and add @SuppressWarnings(value={"unchecked"}) on these classes. At the rest of application, is mandatory developers could not use @SuppressWarnings - except in real generic code (like window managers capable of deal with Window, JFrame and JInternalFrame transparently). For the rest, generics rocks. But, if you use OJB code directly inside your GUI, then you'll have to add @SuppressWarnings - I made this question some time ago on this list, and there is no support for generics inside OJB. Best regards, Richter werner escreveu: Hello! I lately switched to Java 1.5 and get a lot of warnings like this: Type safety: The method add(Object) belongs to the raw type List. References to generic type List should be parameterized I know I can turn off those warnings. But is there a way to use Generics with OJB (for example for 1:n relations)? Thanks, Werner - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Oracle 10g compliance
I've a OJB 1.0.3 running either Oracle 10 XE and SQL 2005 Express without changin a line of code... OJB rocks! Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Profiling OJB
Hi! I'm running OJB under NetBeans 5.0 final with JDK 1.5.0_06 and NetBeans Profiler 5.0, OJB 1.0.3. I just run the app, and I see RepositoryPersistor.readMetadataFromXML(org.xml.sar.InputSource, class) is called twice, taking incredible 5561 ms for execution (a 2780ms per call). It's number two for time startup problems in my app: the first one is ClassHelper.getClass(String, boolean), who takes 9913 ms over 4520 invocations (so I think it's ok, about 2.1 ms per call). My question isn't why so longer readMetadataFromXML, but why twice? Any tips? Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can OJB Be Built w/GCJ 3.3.x?
Notes: 1) SapDB/MaxDB driver don't compile if you just download sources. You need to strip out encription and native portions. 2) Compiled SapDB/MaxDB driver is slower than Java version... I've used GCJ that comes with Fedora distro, and used -o, -o2 -o3. No make diff for performance. Compiled is still slower to connect, slower to query and so on. Richter Thomas Dudziak escreveu: On 12/1/05, Craig A. Vanderborgh <[EMAIL PROTECTED]> wrote: We need to build OJB using gcj 3.3.2 for an embedded system. Is it possible? What experiences have people had using OJB w/gcj 3.3.x? Never tried it, but I think with the newer gcj versions this should be doable. You should check however for prebuilds of the libraries that OJB uses (e.g. commons-lang, commons-collections etc.), usually there are some available or at least steps to get them to compile. On second thought, I think your main problem will be the JDBC driver, not OJB. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handling really large collections
I don't know what is your UI (JSP, Swing or JasperReports), but I'll share my experience: 1) Yes, OJB could handle collections as large as 660.000 records (yes, 660Krecords!!!) - using proxies, of course, and sometimes tweaking some -Xmx, -Xms and other memory options of the VM. I've used it to manipulate (search and update) postal codes of my country, and found no problems at all. 2) When using Swing, for large amount of objects, never use JList - it try to read every object even if it not being shown; Use JTable instead, that will read only records shown. If your logic allow, use pagination + proxy. Work like a charm, and will not "kill" your database... 3) Until JasperReport 1.0, was not possible to deal with very large amount of data. Since 1.0 there is an option, but I never used, and I don't even know if works. It's not an OJB problem, but a JasperReports problem (I expect this been solved since JR 1.0). 4) Never try to render and HTML page with more than 100~250 records: the problem is your client machine (every browser I've tryied - read IE and FireFox - have problems with large pages), except your client machines run Linux and have 1Gb RAM ;-) Best regards, Edson Richter Jakob Braeuchi escreveu: hi laran, yo can use a proxy for the whole collection: http://db.apache.org/ojb/docu/guides/basic-technique.html#Using+a+Single+Proxy+for+a+Whole+Collection jakob Laran Evans schrieb: I have a parent object which owns a collection. The objects in the collection are mapped in ojb. However, the parent may own 10K or more of the child objects. Thus, the collection may be 10K elements or more in size. The child objects each hold references to other mapped objects. Clearly loading the initial parent object would blow up the system. So, I'm trying to figure out a way to load the parent object but load the collection in batches. Is there any mechanism in OJB to do anything similar to this? Does OJB do anything inherently, or can it be made to do so with customization to handle really large collections? I can write custom Query calls if needed. I'd like to stick with as simple a solution as possible. - laran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB 1.0.x and Java5.0
I'll try that example with OJB... Thanks, Edson Richter Thomas Dudziak escreveu: On 8/8/05, Edson Carlos Ericksson Richter <[EMAIL PROTECTED]> wrote: Let me expand my idea (sorry if I get boring). I have a User object. Each user has a LoginHour list. So, using JDK 5.0 could I declare public class User { private String username; private String password; private List loginHours; public void setUsername(String newUsername) {...} public String getUsername() {...} public void setPassword(String newPassword) {...} public Stirng getPassword() {...} public void setLoginHours(List loginHours) { this.loginHours = loginHours; } public List getLoginHours() { return this.loginHours; } } And this will work fine? There is nothing to be changed on class-descriptor, neihter in collection-descriptor? I havn't tried but I think not as the generated bytecode (.class files) will have a plain List in there and the compiler has inserted casts in the appropriate places. You can see for yourself what the compiler generates when you print some info via the java.lang.reflect package for your class, you'll see that there isn't any generic stuff in there. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB 1.0.x and Java5.0
Let me expand my idea (sorry if I get boring). I have a User object. Each user has a LoginHour list. So, using JDK 5.0 could I declare public class User { private String username; private String password; private List loginHours; public void setUsername(String newUsername) {...} public String getUsername() {...} public void setPassword(String newPassword) {...} public Stirng getPassword() {...} public void setLoginHours(List loginHours) { this.loginHours = loginHours; } public List getLoginHours() { return this.loginHours; } } And this will work fine? There is nothing to be changed on class-descriptor, neihter in collection-descriptor? TIA, Edson Richter Thomas Dudziak escreveu: On 8/8/05, Edson Carlos Ericksson Richter <[EMAIL PROTECTED]> wrote: Anyone has an example about how could OJB be used with Generics? This will not affect the class-mapping descriptor? Since Java generics will be compiled to non-generic bytecode, it does not really affect classloading etc. Hence it should not matter when running OJB, you simply specify the collection-descriptor etc. as you would for non-generic code. The only differences are that OJB does not (yet) support enums, and that the XDoclet module might not work with generic code (you'll at least need a CVS build of the XDoclet code to be able to parse 1.5 code). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB 1.0.x and Java5.0
Anyone has an example about how could OJB be used with Generics? This will not affect the class-mapping descriptor? Richter Tino Schöllhorn escreveu: Hi, we are currently thinking of moving from JDK1.4.2 to Java 5.0.x. The most interesting part of new Java Editition is the use of Generics which will lead to a much better understandable code-base. I have a few questions, which might be answered by someone of the OJB community: - Are there any known issues of using OJB 1.0.x with Java 5.0? - If so, will OJB 1.1 work with Java 5.0? - Does anyone use Java 5.0 in a production system? Perhaps someone already has expierience with Java 5.0 and OJB and can share this information. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a problem about oracle connection leak
nce().activePersistenceBroker()); //It keeps increasing and never decreasing. //just like 1,2,3,and so on } }; t_Threads.add(t_Thread); } for (int i = 0; i < t_Threads.size(); i++) { Thread t_Thread = (Thread) t_Threads.get(i); t_Thread.start(); } Is there anybody can provider a solution to me, Thanks much. _ 享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
1.0.0 -> 1.0.3 differences (log)
Hi! I think I'm stupid because I can't find an easy to read doc about what changed between 1.0.0 and 1.0.3 to know what impact could cause this upgrade to my (almost) large project... Today I have about 400K loc heavly integrated into OJB using PB Api and several internals (including dynamic attributes and references). Could someone point me to a change log or something else (if exists), or if this not exist, just tell me - so I don't stay looking for something that I'll never find ;-) TIA, -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Too slow for startup
Hi! I'm researching with NetBeans Profiler, and I found interesting that OJB takes near to 3739ms running method ...ClassHelper.getClass(String,boolean), in 4367 calls... I think I have not too many beans at my app... Someone else tried OJB with profiling tools? Thanks for any tips, -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Vulnerabilities
One: jdbc-connection in .xml file has database password in plain text (besides there is workarounds) - as it's does in every tomcat install around the world... Depends where you puts your .xml files! Two: there is no encryption over data transferred (in real, it's a database dependant protocol issue. As workaround, you could write converters that does the job). Three: it has no clue about password bad user choices (for paranoids, huh? :-D ). Richter Daniel Perry escreveu: I dont think such a list exists. What sort of security vunerabilities are you talking about? Due to the nature of OJB i cant think of any security vunerabilities it could suffer? OJB doesnt store any data itself. Any vunerabilities i can think of would be introduced by a database server ojb is using, the JVM, the OS, the filesystem, or the application that is using OJB. I think the only obvious security vunerability is that (normally) you have the database server username and password in the plaintext repository file. This is a problem with all If you set the file permissions properly, no one can access this. Daniel. -Original Message- From: Pulat Yunusov [mailto:[EMAIL PROTECTED] Sent: 21 December 2004 22:29 To: OJB Users List Subject: Vulnerabilities Is there a list of OJB security vulnerabilities: current and closed? Is this information regularly collected or posted and where, in this list? Thank you, Pulat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Advice on using OJB collections and Struts
I've used the OJB objects and collections directly, since they *are* my VO. There is no need to maintain any kind of "open session", even if you are using proxies (OJB will care about opening a database session to load object on demand)... I never used OJB + EJB, so I can' tell you how this could work in a distributed environment. But with JSP accessing local datasources, I had no problems. Copying object to other objects/collections could lead into unecessary overhead. I expect this helps. Edson Richter Ray escreveu: Hi there ... :-) I'm involved in a small project to convert from a Hibernate backend, to OJB. The presentation tier uses Struts and JSTL to render pages. I was wondering how you OJB handles collections attached to objects, that need to be rendered in the JSP pages. For example, if I have an Order object that contains a collection of OrderLines, and I want to create a page to display the whole order, then what is the bst way to handle this? Is it best to copy the whole Order and OrderLines into some kind of VO, and then send that to the page? Or do you use the Hibernate approach of leaving the session open for the whole request cycle, so that the JSTL on the page, can access the collection directly from the Order object? Hope that makes sense ... :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Complex query with exists
Hi! I'm using OJB 1.0.1. I need to perform the following query: select T.C1 T.C2, sum(U.X1) as total, count(*) as counted from tb1 P join tb2 T on P.id = T.id where not exists (select * from mTonTable where id = P.id and id2 = P.id2) group by T.C1, T.C2 tb1 and tb2 are XML mapped tables. mTonTable is a implicit M:N mapping table. Thanks for any tips. -- Edson Carlos Ericksson Richter MGR Informática Ltda. Fones: 3347-0446 / 9259-2993 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values
You gave me a good idea. I'll create a specialized Persistent field for debugging purposes inside my project. Thankyou, Edson Richter Thomas Dudziak escreveu: Edson Carlos Ericksson Richter wrote: It's not a OJB problem. I'm just looking if OJB could help me find bugs introduced from any programmer here. Sample: I have a class with 5 relations updatables, and when I execute insert, maxdb answer "[-5005] Missing non null value". Besides OJB tell me what bean he is trying to persist, it's difficulty to find what field that messed up. If I tell "nullable='true'" and "nullable='false'" (or something like), then OJB warn me if he finds the field is NULL (when nullable='false') could be a bigger step searching for this kind of app bug. Nothing that I can't debug and try to find using a trace or P6Spy, but in a schema with more than 200 tables, 2000 fields, and 1400 classes, it definitelly could be easier. Hmm, that might be possible by adding a nullable property to the field descriptor and checking it in the persistentfield impls. I'll check that. For now, you could try using a 'pass-through' field conversion that does nothing but checking the value for null. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Null values
It's not a OJB problem. I'm just looking if OJB could help me find bugs introduced from any programmer here. Sample: I have a class with 5 relations updatables, and when I execute insert, maxdb answer "[-5005] Missing non null value". Besides OJB tell me what bean he is trying to persist, it's difficulty to find what field that messed up. If I tell "nullable='true'" and "nullable='false'" (or something like), then OJB warn me if he finds the field is NULL (when nullable='false') could be a bigger step searching for this kind of app bug. Nothing that I can't debug and try to find using a trace or P6Spy, but in a schema with more than 200 tables, 2000 fields, and 1400 classes, it definitelly could be easier. Thankyou for fast reponse, Edson Richter Thomas Dudziak escreveu: Edson Carlos Ericksson Richter wrote: I having several problemas with database in NULL values area. If I inform in XML what fields allow XML and what not, OJB will warn me if I forgot to fill some field? If yes, is this a sanity check that can be enabled/disabled? Could you give an example ? Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Null values
Hi! I having several problemas with database in NULL values area. If I inform in XML what fields allow XML and what not, OJB will warn me if I forgot to fill some field? If yes, is this a sanity check that can be enabled/disabled? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Profiling OJB
Sorry, I can't understand what do you mean with "fields that correspond to field descriptors". Today, I have a set/get method for each field in my VO (value object) classes. Almost every one is a direct mapping from set/get to field. What is the impact over my source code to use direct access and/or auto-proxy? I need to make fields public? Of course you is right. Time spent in each call is really small (about - average - 39,86 ms for setValueFor and 43,09 ms for getValueFrom - but I still fell it's high). Thanks for fast response. Richter Thomas Dudziak escreveu: Edson Carlos Ericksson Richter wrote: I'm just testing our large app using NetBeans Profiler (JFluid), and found that most time my app is spending in setValueFor (41%) and getValueFrom (13%) in PersistentFieldIntrospectorImplNew class. Someone knows if any other Persistent* class is faster? The question is: how long does it spend on average in these methods ? If this time is small, then you problem is probably elsewhere. Also, if you have fields that correspond to the field descriptors, then you can use the direct-access impl or the auto-proxy impl which delegates to the introspector or direct-access impl depending on the field. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Profiling OJB
Hi! I'm just testing our large app using NetBeans Profiler (JFluid), and found that most time my app is spending in setValueFor (41%) and getValueFrom (13%) in PersistentFieldIntrospectorImplNew class. Someone knows if any other Persistent* class is faster? Thanks for any info share, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection broken
I'll do checks and answer in a few hours (it take few hours to I get the error again - it's not determinate). Thank you for directions. Richter Armin Waibel escreveu: Hi Edson, Edson Carlos Ericksson Richter wrote: Hi, guys. I'm deploying a really big app written using OJB (today is about 36 loc), that uses MaxDB as database server. I've a test connection query (select 1 from DBA.DUAL), and it works. But after some time of work (about 4 hours of continuous use), OJB loose one connection, and never get it working again. May be this a known bug for OJB 1.0.1? Should I upgrade DBCP (I'm using it)? It's not a known bug. Other user posted about an issue when using lazy collection references, but I never notice an issue about "lost connections". How does OJB loose the connection? Will it be removed from pool without closing or never returned to pool and timed out? Did you get any error message, stack trace? I've checked past threads, but just only one appear be related... And tests exchanging DBCP to ConnectionPool don't solved. Both implementations ConnectionFactoryDBCPImpl and ConnectionFactoryPooledImpl rely on commons-pool, so they should behave in same way. Using no connection pool appear be solved, but our app is high query/transaction intensive, and opening a connection is an issue for us (we use a pool of 10 connections per user here, and we have ~40 users)). This indicate that OJB does a good job and close all used connections, but maybe the issue only disappear because of reduced performance. Do you use the 'maxIdle' property in ConnectionFactoryPooled/DBCPImpl? regards, Armin Thanks for any help, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Connection broken
Hi, guys. I'm deploying a really big app written using OJB (today is about 36 loc), that uses MaxDB as database server. I've a test connection query (select 1 from DBA.DUAL), and it works. But after some time of work (about 4 hours of continuous use), OJB loose one connection, and never get it working again. May be this a known bug for OJB 1.0.1? Should I upgrade DBCP (I'm using it)? I've checked past threads, but just only one appear be related... And tests exchanging DBCP to ConnectionPool don't solved. Using no connection pool appear be solved, but our app is high query/transaction intensive, and opening a connection is an issue for us (we use a pool of 10 connections per user here, and we have ~40 users)). Thanks for any help, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB in Tomcat
Have you tryied NetBeans 3.6? I'm using OJB without problems, in standalone and web apps with 3.6. I know NetBeans 4 B2 has some flaws in this area... I think you test latest Q build too.. Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT]Sorry to the community
I must to say sorry to this great community, by my last mails to Mr. Ilias Laziradis (not sorry to Mr. Laziradis itself). In this context, I need to open a parentesis, and sintetize my frustation when trying to help people who want's no help. Some time ago, the same Mr. Ilias Laziradis started as any other begginer, in the NetBeans maillist, asking some simple question. As I always does, I tryied to help him, sintetizing some years of reserach over Java plataform, the solutions I've found (including he is here today because I told him about OJB!!! - since he can't research by himself, proablly he never come to here if I never pointed him), and that kind of complete solution he wants simple doesn't exists. He said, that time, he is more competent to find that kind of solution, because he is more prepared (?!). Even that time, when the NetBeans community start to ask NetBeans team to ban him, I stay at Mr.Laziradis side and asked to let him there. Whell, I changed my mind. If I can, I'll recomend every mail list I participate to block this user. Every thing he does is exchange a dozen of mails, and then say that "this tech is a failure", or "this company is a failure", or "this project is a failure" (as he done with NetBeans, and as he started to say about OJB). I'm sorry to all who listen this noise, and I want to keep my self cool, and trying to not make this bad experience influency my spirit of help begginers (as I was in the past, and too many had patience with me). To Mr. Laziradis, I'm sad to see how far the link to lisp discussion I posted about your condute is right. You remember me the "Nowhere Man - The Beatles". To the community, you'll never see here another mail from (initial or a response) me directed to Mr. Laziradis - even if I know the answer about his questions. This will avoid him of ignore me, the technology, and the knowledge. Or even say that learn Java is irrelevant. End. Sorry, and let's go with this great project. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
I'm sorry, I sent additional response before read your ask. I'm stoping right now. Best regards, Edson Richter Jakob Braeuchi escreveu: hi all, i think it's time to stop this thread. jakob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
Ok, my patience is over limit. I was contrary to your baniment from NetBeans maillists. I defended you right to express your self. I've tried to help you with usefull information. Right now, I'll recommend every mail list where I find you to ban you. It's incredible your capacity to be "unglentle" with people trying to help with usefull information. Dozen of people (including myself) made research, analized, and spent time to respond you, to you say it's irrelevant or it's a failure. Look yourself in a mirror, and thing again. You is a "walking failure", going from maillist to maillist, getting people hungry against you. Be happy ignoring usefull things I said. And NEVER tell me what I can or can't post as response to the thread. AFAIK my comments about learn Java it very topic-related - since your question is very basic about how java.exe works. This maillist isn't to teach Java. If you don't like it, ignore it. It's your problem. Just to let you know, I'm a regular member of this list, and NEVER was told ungentle with nobody. At contrary, I spent some hours discussing things and how to get it working, and contributing code to the project, and sharing experiences with begginers. Best regards, Edson Richter Ilias Lazaridis escreveu: Edson Carlos Ericksson Richter wrote: Unfortunatelly to behavior of Mrs. Laziradis, I fell in obligation to share this info in this mail list too. I'll do this because, as occured at other mail list, communications starts to degrade, making too much noise for about nothing. This info was shared from another user, in another mail list. Who is bored by Mr. Laziradis comments about "failures" and so on, check this link: http://www.tfeb.org/lisp/mad-people.html I still trying to argue with him, with reasonable arguments, and asking him to learn java before judge, but his always start saying that learn Java isn't important... Once more: your suggestions related to my processing model are irrelevant to me. More and more, any of your suggestions becom irrelevant to me. - You have 'warned' this communtiy, so it's fine. Please avoid further off-topic traffic, or open at least a new thread marked with "[OT]". - The team has provided the requested obj-blank: http://www.mail-archive.com/ojb-user%40db.apache.org/msg12135.html So, everything is fine. . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
Unfortunatelly to behavior of Mrs. Laziradis, I fell in obligation to share this info in this mail list too. I'll do this because, as occured at other mail list, communications starts to degrade, making too much noise for about nothing. This info was shared from another user, in another mail list. Who is bored by Mr. Laziradis comments about "failures" and so on, check this link: http://www.tfeb.org/lisp/mad-people.html I still trying to argue with him, with reasonable arguments, and asking him to learn java before judge, but his always start saying that learn Java isn't important... Best regads, Edson Richter Daniel Perry escreveu: the quickstart application (ojb-blank, with e.g. tutorial1 within) This should be runable withount _any_ domain-knowledge (except: Operating System Basics). If a team did not achieve that, then I name it: failure. What??? OJB is most definately NOT designed for people without any domain knowledge! What use is OJB to someone who doesn't have a decent knowledge of java? None! OJB is only used by end users when it's embedded into some larger application - and they should never know it's using OJB unless there's an ackoledgement of some kind! OJB is targetted at the developers of such applications. A java application developer with no knowledge of java is a fairly useless commodity (i can think of the number of vb/access programmers who know nothing about general programming, sql, etc - and it shows in their work!) This is like saying that you shouldnt need to have driving lessons to drive a car! Madness! I agree that a good introduction to OJB is important, but to be frank, i found the written tutorials and their uncompilled code far more useful than running them! In order to use OJB productively you MUST spend time understanding how it works. Running the tutorial doesnt do that. Your comments regarding the OJB team are very unfair. I wouldnt consider myself part of the 'team' as i do very little towards development of OJB, but i feel angry at your comments. I (and i am sure this goes for the other OJB developers) have a day job, and a life outside of work. I find it almost insulting that you insist on someone mailing you a cvs checkout after several people have pointed out how you can do this yourself, and hopefully learn somthing in the process, without us wasting time doing it for you. Daniel. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
Huh, you started again with this "failure" thing. Start to learn something, or you will always be a failure. I'm patiently seen you make same noise you made in NetBeans mail lists... I think you want a "wizard that make all you want withou knowing anything about java - except that there is a language with this name - and get a full-java-system-working-with-database-and-cross-plataform-plus-setup cookie recipt". If someone else seen your requirements about what you really want to do in the NetBeans list, will know that are impossible to meet your requirements (except about a hundred years ahead - where AI will came to machines ;-) ) I'll be happy if you start to learn, and polute less our lists... After that, I'll happy sharing my knoledge about OJB, including how to run OJB inside NetBeans (that you not asked yet - but soon or later will ask too). Best regards, Richter Ilias Lazaridis escreveu: Thomas Dudziak wrote: Ilias Lazaridis wrote: Right. Hmm, lets see: OJB is a Java library / O/R mapping framework, so what you need to know *in advance* in order to use it would be Java. Likewise, OJB uses Ant for building, so you also need at least a little bit of knowledge about Ant, e.g. how to install Ant, how to invoke it. This is only true, if the ojb-developers fail to encapsulate the domain knowledge. No, OJB helps you with some of the technical knowledge (i.e. databases) but not with domain knowledge (e.g. finance, e-shop ...). And OJB does not away with all technical knowledge. You're still required to be able to program in Java, use Ant etc. (as I've already written). Context of my statement (as the context of this thread): the quickstart application (ojb-blank, with e.g. tutorial1 within) This should be runable withount _any_ domain-knowledge (except: Operating System Basics). If a team did not achieve that, then I name it: failure. If you're not willing to get this knowledge, then you're right, then we as the developers have difficulties to provide you the 'solution' because we cannot and will not teach you Java or Ant, you will have to do this yourself if you want to get anywhere in the Java world (as with any other computer language or environment). We are talking about a "run" and a "deploy" abstraction. Which you have finally created, but not posted to the threads where i've asked for it. In case you forgot: Jakob created this run 'abstraction' for you days ago, but you kept demanding something better or other. I did not forget. This was not for obj-blank, but for something without sources (the result of the ojb-quickstart target). [again: my context is ojb-blank with the tutorial1 sources] All I did was make the generation of these run.bat and run.sh files automatic within ojb-blank, as you could have known when you had actually read my mail and would have bothered to check out the changes (btw, the dev-mailing archive is easily accessible from the OJB homepage, all info about the change are there). So please stop this accusing. You are accusing. Me, that I am accusing. Which is false. again i remind you the context: addition/change to ojb-blank And please, 'requesting' stuff won't get you anywhere because it is rude. "Requesting" is not rude. RFC = Request For Comments. - I'm afraid you're confusing "requesting" with "demanding". "Requesting": means in German: Bitten, Anfragen. Thanks, but I know the difference. Rather, I think you mistake demanding for requesting, judging from the tone in your mails. So, you don't want to apologize for saying to me that i behave "rude" based on an faulty interpretation of yours? I see. You should be polite (as everybody else on this list is), and read the docs (because that is what there are for) and ask for help if you're stuck. And if you can provide input or corrections or improvements, all the better, as we're more than willing to incorporate them into OJB. I don't think that the people on this list (especially you) are very polite. Otherwise you would not hide changes, which were initiated by an individual (me) behind necessary domain-knowledge (CVS acess). You wrote this large message here, but you've still not posted the corrections to the list, thus the thread becomes usable in the archives (and i get my solution). Btw, as I said I don't think that a quickstart won't get you anywhere, because it only shows that OJB works, but not how. That is what the getting-started doc and the ojb-blank is for. If you think that you can enhance the doc, great, go ahead and post whatever you have to this list. As said again: I depend on a minimum assistance from the developers. But it seems that stubberness and egoism rules in this project. And we are unpolite? Yes. But i've cooled down now. Come on, in every answer that you've got to your not exactly polite mails, you've got constructive and polite help from users and developers of OJB, and you still keep on insulting people although you cannot bas
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
You raised an off topic question when you asked "why not java -cp .;lib\*". It denotes completelly lack of important knowledge about Java plataform, absolutelly needed to work with OJB or ANY java library. My answer isn't off topic. You asked, I answered. But as always, when you receive and email suggesting you learn Java, you start to "defend yourself", and to say that learn Java is irrelevant. It isn't. As I said before (and I said in NetBeans mail list too), you MUST start learning Java. After that, you could use tools for Java development, and libraryies to do that. Until there, anything else you say is irrelevant to me. You make too much noise without knowing what you are doing. Sometime you shot the target, but it's just lucky. Learn Java. After that, you will find that OJB is too easy to work! And you should be interested in Java documentation. Without them, you could not startup anything in Java land. Edson Richter Ilias Lazaridis escreveu: Edson Carlos Ericksson Richter wrote: Check "Java Tools documentation" in Java docs (downloaded separately). [I'm not interested in the documentation, but in the design-rationales. This is more out of curisity.] As I said before, is hard to tech Java in some kind of mail lists (as either in NetBeans mail lists)... First step you should do, to do what you want, is learn Java (not only language, but plataform too). Second is learn tools and libraries. Third step is try to contribute to the projects. You should know this already: your suggestions subjecting "the process of learning java" and "the process of contributing to projects" did not have any relevance for me. - If you like to assist me, please focus on the questions I raise and avoid off-topic comments. . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
Read basic Java documentation from Sun (link "Tool docs"). Edson Richter Ilias Lazaridis escreveu: Thomas Dudziak wrote: Ilias Lazaridis wrote: [...] What is the reason, that java -cp build\classes;lib\*.jar org.apache.ojb.tutorial1.Application java -cp build\classes;lib\* org.apache.ojb.tutorial1.Application java -cp build\classes;lib\ org.apache.ojb.tutorial1.Application or something similar is invalid? Erm, have you actually tried it ? It's because java.exe *cannot* do this ! Yes, i've tried it. And it does not work. And I just asked, _why_ this is invalid (or: why java.exe cannot do this). Possibly one can point me to a location, where I can find the rationales behind this behaviour. . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [QUICKSTART] - A OJB quickstart similar to hibernate
Check "Java Tools documentation" in Java docs (downloaded separately). As I said before, is hard to tech Java in some kind of mail lists (as either in NetBeans mail lists)... First step you should do, to do what you want, is learn Java (not only language, but plataform too). Second is learn tools and libraries. Third step is try to contribute to the projects. Best regards, Edson Richter Ilias Lazaridis escreveu: Ilias Lazaridis wrote: Jakob Braeuchi wrote: hi ilias, well, actualy it's possible to do something like this java -classpath "the;classpath" whatever.you.main.class.is but the classpath will be quite long ;) java -cp classes;lib\antlr-2.7.3.jar;lib\commons-beanutils.jar;lib\commons-collections-2.1.1.jar;lib\commons-dbcp-1.1.jar;lib\commons-lang-2.0.jar;lib\commons-logging.jar;lib\commons-pool-1.1.jar;lib\db-ojb-1.0.1-junit.jar;lib\db-ojb-1.0.1.jar;lib\hsqldb.jar;lib\log4j-1.2.8.jar org.apache.ojb.tutorial1.Application [...] Now I understand! Thank you! What is the reason, that java -cp build\classes;lib\*.jar org.apache.ojb.tutorial1.Application java -cp build\classes;lib\* org.apache.ojb.tutorial1.Application java -cp build\classes;lib\ org.apache.ojb.tutorial1.Application or something similar is invalid? . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [SUGGESTION] - S02 - Answering behaviour on this forum
Hi, Ilias. Good to see you here (too). I'm following OJB project sice beta days, and I just reporting that some threads are not answered because they are in the docs AND/OR are avaliable in past threads. My experience at OJB mailing lists is that valid threads, and that are not already answered in past, are rapidly answered. As always I have opportunity, I congrat the OJB team due their fast responses and solutions, and to be open to discuss constructivelly even was my personal mistakes. Best regards, Edson Richter Ilias Lazaridis escreveu: I've noticed several threads, which remained unanswered. This could imply to visitors that the product OJB is death (or not yet alive) You should ensure that every request is answered, If possible with a pointer to some resource. . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Friendly messages
Is there any chance to add the classname (or table name or query executed) when the following error occur? org.apache.ojb.broker.PersistenceBrokerSQLException: com.sap.dbtech.jdbc.exceptions.DatabaseException: [-4005] (at 988): Unknown column name:SITUACAO Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Will have Ojb new release near???
Hi! I just want to ask for a "1.0.2" release of OJB with latest fixes... Is there any plans? Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regd Updating Selected Columns
Just my 2c (dont blame me if it's too simplistic): I've implemented "selective updates" in current OJB 1.0.1 creating two beans to same table. I 've used PropertyUtils.copyProperties to transport info from one bean to another. This will work for references, collections supers and so on. To let you know, my "mini" bean has no collections, and references to only objects desired by the project. In real, my most selective bean is extended by the less restrictive bean. Then I don't put in ojb repository, and make two mappings. Was relativelly easy (but I'll recommend you make a class diagrams for every thing, because inherace make projects starts to be highly complex), and make no need to change OJB at all. Best regards, Edson Richter Armin Waibel escreveu: Hi Ludo, Ludovic Maitre (POP - Factory Part) wrote: Hello Armin, This is tried. The code is good but only for updating selected fields not the reference objects (foreign keys and collections). right, the intention is to allow update of "normal" fields. In fact, if we add the necessary code to fetch also the object references descriptors, the collection descriptors, the corresponding class descriptors, the anonymous fields corresponding to the object references descriptors... this become heavy. As i have understand the update method in OJB 1.1, it operate only on fields also, isn't it ? yep The "hasMultiMappedReference" at the end of the update method is for fetching somethink like a super class no ? It isn't for fetching (and filtering) the objects reference descriptors to update ? right, references will be ignored (except the "super"-references to support fields of inherited fields). I think you need another feature scheduled for OJB1.1 which will allow runtime changes of the auto-xxx settings of references. I not started work today (my prototype was lost in a hard-disk crash some month ago ;-)). Here is a post made to this subject http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=6912 regards, Armin Regards, Ludo Armin Waibel wrote: Hi Ludo, if "enableChangePerThread" is set true, your workaround should be valid. The only drawback is the >DescriptorRepository dr = manager.copyOfGlobalRepository(); call. If you have thousands of objects this method is costly (serialization of the DescriptorRepository instance). Think to make it faster (but more complex) you can try to use a temporary DescriptorRepository instance with temp ClassDescriptor (not tested, only suggestion, does not work when using multiple joined table): Seems to be complex, but should be faster than serialize the whole global DescriptorRepository on each method call. public void update(Object target, String[] fieldsToUpdate) { DescriptorRepository temp = createTempRepositoryFor( manager.getRepository().getDescriptorFor(target.getClass()), fieldsToUpdate); manager.setDescriptor(temp); PersistenceBroker broker = getBroker(); try { /* now we can store the object to update */ //... broker.beginTransaction(); broker.store(target); broker.commitTransaction(); //... cleanup broker, exception handling } finally { manager.setDescriptor(null); } } private DescriptorRepository createTempRepositoryFor(ClassDescriptor target, String[] fieldsToUpdate) { DescriptorRepository temp = new DescriptorRepository(); ClassDescriptor cld = new ClassDescriptor(temp); temp.setClassDescriptor(cld); // if an schema was used this method need more tweak to resolve table name cld.setTableName(target.getFullTableName()); FieldDescriptor[] fields = getFieldsToUpdate(cld, fieldsToUpdate); for(int i = 0; i < fields.length; i++) { FieldDescriptor field = fields[i]; cld.addFieldDescriptor(field); } return temp; } private FieldDescriptor[] getFieldsToUpdate(ClassDescriptor target, String[] fieldsToUpdate) { ArrayList result = new ArrayList(); FieldDescriptor[] fields = target.getFieldDescriptions(); for(int i = 0; i < fieldsToUpdate.length; i++) { String fieldName = fieldsToUpdate[i]; for(int k = 0; k < fields.length; k++) { FieldDescriptor field = fields[k]; if(field.getPersistentField().getName().equalsIgnoreCase(fieldName)) { // make deep copy of used field result.add(SerializationUtils.clone(field)); break; } } } if(fieldsToUpdate.length != result.size()) { // throw exception, not all fields could be found } return (FieldDescriptor[]) result.toArray(new FieldDescriptor[result.size()]); } regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [
Re: SQLExcpetion
If you try to copy large files between machines, you get Connection Reset (or connection reset by peer, in some OSes)??? If so, you get a trahsed network card or network hub... I had this problem some time ago, and I had to exchange a hub with some ports "burned", sending trash in my network... Just my 2c, Richter Daniel Perry escreveu: Hi all, One of our systems has been running fine (live) for the last few weeks until yesterday when for about half an hour it started randomly crashing. Since then it has been fine! The (partial) exception trace is below. From what i can figure the problem is coming from dud mysql connections. However, i thought that OJB checked the connection before using it by using the validation query? I'm using OJB 1.0.0, mysql-connector 3.0.10, and mysql 4.0.18. Any ideas about what would cause this? Anyway i can prevent it occuring again? Thanks, Daniel. [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: No operations allowed after connection closed. Connection was closed due to the following exception: ** BEGIN NESTED EXCEPTION ** java.sql.SQLException MESSAGE: Communication link failure: java.io.IOException, underlying cause: Unexpected end of input stream ** BEGIN NESTED EXCEPTION ** java.io.IOException MESSAGE: Unexpected end of input stream STACKTRACE: java.io.IOException: Unexpected end of input stream at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1455) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1826) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1098) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1192) at com.mysql.jdbc.Connection.execSQL(Connection.java:2051) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.(Unknown Source) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(Unkn own Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Unknow n Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) at org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.loadData(Unknown Source) at org.apache.ojb.broker.core.proxy.ListProxyDefaultImpl.loadData(Unknown Source) at org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.getData(Unknown Source) at org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl.iterator(Unknown Source) at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator (ForEachSupport.java:329) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Patch: DB2 BigDecimal problem (truncation occurs and data is lost)
Is this the latest driver (7.5.xxx)? I've seen a message in MaxDB list about bug in JDBC driver concerning decimal precision and nasty roundings... My2c, Richter Em Qua, 2004-08-18 às 15:55, Armin Waibel escreveu: > Hi Jason, Stuart, > > it's an really nasty issue! If I apply 'option 3' > > > else if ((value instanceof BigDecimal) && (sqlType == Types.DECIMAL > || sqlType == Types.NUMERIC)) > { > ps.setObject(index, value, sqlType, > ((BigDecimal) value).scale()); > } > > > sapDB/maxDB does not pass NumberAccuracyTest: > > Testcase: testBigDecimal took 0,015 sec > FAILED > expected:<67.3456> but was:<67.0> > junit.framework.AssertionFailedError: expected:<67.3456> but was:<67.0> > at > org.apache.ojb.broker.NumberAccuracyTest.testBigDecimal(NumberAccuracyTest.java:55) > > seems that in that case maxDB has problem with scale setting. > If I use option 2 > > else if(sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) > { > ps.setObject(index, value); > } > > All tests pass. > What to do? > - Apply option 3 to default Platform and override > #setObjectForStatement(...) in maxDB to use option 2 or old behavior? > - Apply option 2 to default Platform and override Sybase Platform > #setObjectForStatement(...) and use option 3 for Sybase? > - Apply option 2 for DB2 and option 3 for Sybase? > > regards, > Armin > > > > Jason Mihalick wrote: > > Armin Waibel wrote: > > > >> I local apply your patch to PlatformDefaultImpl and run the test-suite > >> against sapDB/maxDB with success. > >> So, what do the experts think about it? ;-) > >> Apply this patch to PlatformDefaultImpl? > >> > > I haven't corresponded yet with the other folks that replied to my post, > > but I do think since other folks are seeing the problem in Sybase and > > other platforms that it does indeed belong in PlatformDefaultImpl. > > Also, if you look at the JavaDoc for setObject... > > > > Option 1 -> > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setObject(int,%20java.lang.Object,%20int) > > > > > > > > vs. > > > > Option 2 -> > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setObject(int,%20java.lang.Object) > > > > > > > > OR > > > > Option 3 -> > > http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html#setObject(int,%20java.lang.Object,%20int,%20int) > > > > > > > > it's pretty evident that either the 2nd or 3rd option is the proper > > choice here. That brings up the question, which is the best choice? > > Even though I know that option 2 works for DB2, it does seem like option > > 3 is the saftest route to go. The JavaDoc is pretty explicit for option > > 3 about the handling of DECIMAL data types. So after having reviewed > > this in more detail, my vote would be to go with the patch as suggested > > by Stuart Heriot in the following post: > > > > http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=13981 > > > > > > > >>> > >>> This posting, incidentally, did receive some feedbadk from other > >>> users saying that they had seen the same problem. > >>> > >> > >> Do all of them agree apply the patch in PlatformDefaultImpl? Does it > >> solve the sybase problem too? > >> > > Yes, I think the concensus is to go with Option 3 above. > > > > Thanks, > > Jason > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XDoclet & empty .xml
Another programmer made a change to our build.xml (and not reported). He added our src folder to classpath of taskdef so we can find custom conversion classes... I think this did the trick at all. Sorry by posting this "fake" solution to fast before checking all facts. Richter Em Qui, 2004-08-12 às 04:10, Thomas Dudziak escreveu: > Edson Carlos Ericksson Richter wrote: > > > I'm shamed. My files are not being processes because I had spaces around > > equals sign. Like this: > > > > /** @ojb.class table = "TB1" */ > > > > correcting to this: > > > > /** @ojb.class table="TB1" */ > > > > worked fine. > > Hmm, this shouldn't be a problem. I just verified this, and spaces > around the equals sign don't matter. Perhaps you changed something else, > too ? > > Tom > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XDoclet & empty .xml
Hi! I'm shamed. My files are not being processes because I had spaces around equals sign. Like this: /** @ojb.class table = "TB1" */ correcting to this: /** @ojb.class table="TB1" */ worked fine. Thanks, Richter Em Ter, 2004-08-10 às 18:13, Thomas Dudziak escreveu: > Edson Carlos Ericksson Richter wrote: > > > Changed to > > > > > > > > and > > > > > > > > and just less messages (only one, in a class that isn't a bean at all > > and either isn't in beans directory...), but still not generating any > > content to .xml > > > > Why is doclet processing files in other directories that are not under > > criteria I specified in fileset? > > Please post this error. > > Tom > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XDoclet & empty .xml
Em Ter, 2004-08-10 às 16:52, Thomas Dudziak escreveu: > Edson Carlos Ericksson Richter wrote: > > > Of course, I already updated with latest from CVS. > > No need to, there were no changes to the XDoclet module since 1.0 final. > > >>I've updated to OJB 1.0 and now I'm trying OJB doclet module. > >>I already documented some classes with ojb.class and so on, but I always > >>get an empty .xml file with only 2 lines of commets. There is no error > >>message, only ones like > >> > >>INFO: Some classes refer to other classes that were not found among the > >>sources or on the classpath. (Perhaps the referred class doesn't exist? > >>Hasn't been generated yet?) > >>The referring classes do not import any fully qualified classes matching > >>there classes belong to the same package as the referring class. The > >>classes are: > >> '..\Project\br\...\beans\MyBean.java --> My qualified to > >>br...beans.My') (one line like this for each interface) > >> > >>Where My is an interface to MyBean and doclets are in MyBean. > >> > >>My target is: > >> > >> > >> >> classname="xdoclet.modules.ojb.OjbDocletTask" > >> classpathref="project.class.path"/> > >> > >> > >> >>destinationFile="${src}/ojb/repository_auxo.xml"/> > >> > >> > >> > >> > >>Any tips? > > This is an error message from XDoclet itself. My guess is that the > MyBean class is in package br...beans which leads to problems as you > specify the directory containing the java file (beans) rather than the > directory that contains the directory structure that matches the package > name (${src}). > > Tom > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > Changed to and and just less messages (only one, in a class that isn't a bean at all and either isn't in beans directory...), but still not generating any content to .xml Why is doclet processing files in other directories that are not under criteria I specified in fileset? Thanks, Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: XDoclet & empty .xml
Of course, I already updated with latest from CVS. And more one detail: I'm using NetBeans 3.6 with Ant 1.6.1. Thanks for any tips, Richter Em Ter, 2004-08-10 às 16:24, Edson Carlos Ericksson Richter escreveu: > Hi! > > I've updated to OJB 1.0 and now I'm trying OJB doclet module. > I already documented some classes with ojb.class and so on, but I always > get an empty .xml file with only 2 lines of commets. There is no error > message, only ones like > > INFO: Some classes refer to other classes that were not found among the > sources or on the classpath. (Perhaps the referred class doesn't exist? > Hasn't been generated yet?) > The referring classes do not import any fully qualified classes matching > there classes belong to the same package as the referring class. The > classes are: > '..\Project\br\...\beans\MyBean.java --> My qualified to > br...beans.My') (one line like this for each interface) > > Where My is an interface to MyBean and doclets are in MyBean. > > My target is: > > > classname="xdoclet.modules.ojb.OjbDocletTask" >classpathref="project.class.path"/> > > > destinationFile="${src}/ojb/repository_auxo.xml"/> > > > > > Any tips? > > Thanks, > > Richter > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
XDoclet & empty .xml
Hi! I've updated to OJB 1.0 and now I'm trying OJB doclet module. I already documented some classes with ojb.class and so on, but I always get an empty .xml file with only 2 lines of commets. There is no error message, only ones like INFO: Some classes refer to other classes that were not found among the sources or on the classpath. (Perhaps the referred class doesn't exist? Hasn't been generated yet?) The referring classes do not import any fully qualified classes matching there classes belong to the same package as the referring class. The classes are: '..\Project\br\...\beans\MyBean.java --> My qualified to br...beans.My') (one line like this for each interface) Where My is an interface to MyBean and doclets are in MyBean. My target is: Any tips? Thanks, Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
auto-delete='object' and RemovalAware...
Hi! I want to know if I use auto-delete='object' in my collection descriptor, and still need to define the collection-class='RemovalAwareSomething' as I used in the past? Thanks. Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Doclet & OJB 1.0
You are absolutely right! I had an old db-ojb-1.0rc6 jar lost my jurassic classpath... Thanks, Richter Em Qui, 2004-08-05 às 17:02, Thomas Dudziak escreveu: > Edson Carlos Ericksson Richter wrote: > > > I`m upgrading today from rc6 to 1.0, but I can't get OJB Doclet running. > > Always I get > > > > Can't create a ojbrepository element under ojbdoclet. Make sure the jar > > file containing the corresponding subtask class is on the classpath > > specified in the that defined {2}. > > > > The taskdef is: > > > > >classname="xdoclet.modules.ojb.OjbDocletTask" > > classpathref="project.class.path"/> > > > > And all jars for xdolet are in my project.class.classpath (I'm using > > NetBeans with Ant 1.6 if this helps). > > > > The compile task is: > > > > > > > > > dir="${src}" > > includes="**/*.java"/> > > > > > > > > Any tips? > > My guess is that some library is missing. You can run Ant with the -v or > -debug argument to get more info. > If that doesn't get you anywhere, have a look at the ojb-blank archive > which you can download from the OJB website. Its build file uses the > XDoclet module. > > Tom > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Doclet & OJB 1.0
Hi! I`m upgrading today from rc6 to 1.0, but I can't get OJB Doclet running. Always I get Can't create a ojbrepository element under ojbdoclet. Make sure the jar file containing the corresponding subtask class is on the classpath specified in the that defined {2}. The taskdef is: And all jars for xdolet are in my project.class.classpath (I'm using NetBeans with Ant 1.6 if this helps). The compile task is: dir="${src}" includes="**/*.java"/> Any tips? Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Res: Re: addOrderBy
I use Criteria crit = new Criteria(); crit.addEqualTo("nf", nf); QueryByCriteria q = new QueryByCriteria(Note.class, crit); q.addOrderByAscending("company.type"); Richter Em Sex, 2004-07-30 às 11:45, Glauber Andrade escreveu: > I don´t understand... > What should I do ? > > Criteria crit = new Criteria(); > crit.addEqualTo("nf", nf); > // crit.addOrderBy("company.type", true);// deprecated > Query query = new QueryByCriteria(Note.class, crit); > > > ---Mensagem original--- > > De: OJB Users List > Data: 07/30/04 11:22:49 > Para: OJB Users List > Assunto: Re: addOrderBy > > I think you should create a QueryByCriteria, and the use the > addOrderBy > on the query. > > Richter > > Em Sex, 2004-07-30 às 11:19, Glauber Andrade escreveu: > > Hello, > > > > I was using rc5 and I changed to 1.0.0 today. > > > > I use Criteria.addOrderBy() and now it has been deprecated. How do I > > order ?? > > > > Glauber > > > > > > > > > > > > > > IncrediMail - O mundo do correio eletrônico finalmente > > desenvolveu-se - Clique aqui > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > IncrediMail - O mundo do correio eletrônico finalmente > desenvolveu-se - Clique aqui - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: addOrderBy
I think you should create a QueryByCriteria, and the use the addOrderBy on the query. Richter Em Sex, 2004-07-30 às 11:19, Glauber Andrade escreveu: > Hello, > > I was using rc5 and I changed to 1.0.0 today. > > I use Criteria.addOrderBy() and now it has been deprecated. How do I > order ?? > > Glauber > > > > > > > IncrediMail - O mundo do correio eletrônico finalmente > desenvolveu-se - Clique aqui - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still my Problem with the PercistanceBroker
Some old versions of Oracle have a trouble with resultsets & cursors... I faced this problem, and the unique solution I've found was close first the resultset, then the statement (that releases cursors) and finally, the connection. I don't know how OJB closes connections (and statements, and resultsets), but I'll recommend you to look for updated JDBC driver (and test the native one and the pure java too), to know if this apply to you. Best regards, Edson Richter Eu tive esperiências com Oracle algum tempo atrás, e haviam muitos problemas relacionados a ResultSets e Cursors. A única solução que achei foi fechar primeiro o ResultSet, então o Statement (o que liberava os cursors no lado do database), e finalmente a conexão. Eu não sei como o OJB fecha as conexões (e Statements, e ResultSets), porém eu recomendo a você dar uma olhada em drivers JDBC atualizados (e testar o driver nativo - OCI - e o puro Java, pois eles tem comportamento diferente), para saber se você está enfrentando o mesmo problema que eu enfrentei no passado. []s Edson Richter Em Qui, 2004-07-08 às 15:53, Cesar escreveu: > Hi People > > Somebody would know to say me what it happens for ojb to log this Info? > > "7202369 INFO [Thread-2] accesslayer.ConnectionFactoryPooledImpl - Destroy > object was called, try to close connection: > [EMAIL PROTECTED]" > > Thanks > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB map
Of course, you can. Sim, você pode. Richter Volnei wrote: Obrigado, Bom eu realmente não sou um expert em inglês, porém eu sou novato em OJB e não gostaria de incomodá-lo sempre que eu tiver uma dúvida boba. Mais, se puder ajudar ficaria muito grato. A dúvida é a seguinte: Se eu tiver uma tabela PESSOA eu posso ter mais de uma classe mapeada para esta tabela? Agradeço antencipadamente, Volnei - Original Message - From: Leandro Rodrigo Saad Cruz To: OJB Users List Sent: Thursday, June 24, 2004 11:21 AM Subject: Re: OJB map Hi Volnei. I can see that you are from Brazil. If you have a hard time writing in english you can mail me in portuguese if you want. Using the mailing list is always better, but sometimes they can't help you if they don't understand what you mean. Olá Volnei. Estou vendo que você é do Brasil. Se você tem dificuldade com inglês, vc pode me escrever diretamemte. Usar a lista é sempre melhor, mas se vc quiser usar o português te que escrever diretamente pra mim. On Thu, 2004-06-24 at 10:57, Volnei wrote: > I'm desenvolvedor web and very am interested in the OJB. I have some > doubts of beginning, for example if I to want to map the same table > for two different classrooms, for example in the case of TO (VO or > DTO) ? > > Thanks > > > -- Leandro Rodrigo Saad Cruz InterBusiness Tecnologia e Serviços IB- www.ibnetwork.com.br DB- www.digitalbrand.com.br OJB - db.apache.org/ojb XINGU - xingu.sf.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] OJB 1.0rc7 Released
To me, default doesn't matters... Just be really clear in DOCS that the changes are made, because I've a near to 265000 loc here that uses either RemovalAware and Non-RemovalAware behaviour... Best regards, Edson Richter Armin Waibel wrote: Steve Clark wrote: Armin Waibel writes: Armin> ooh, seems I made a mistake in the test cases repository I Armin> don't specified a "non-removeaware" collection-class. Maybe Armin> I should read the docs before I start writing the next test Armin> cases ;-). Not to beat a dead horse, but I think this is yet another very clear demonstration that the default behavior is counterintuitive. It really seems that it would be better for non-RemovalAwareCollection to be the default, with RemovalAwareCollection available as an option for those who want that behavior. I agree with you, but some time ago the argument for using RemovalAwareCollections as default collection-class was to make PB-api delete collection objects behaviour similar to the ODMG-api. I don't know when we change collection-class, but originally non-RemovalAwareCollection was used as default one. If most OJB user vote for an rollback to non-RAC, we can switch back again (hopefully the last time ;-)). As an alternative I will have a look in source and try to make default collection-class pluggable via OJB.properties file. If it will be possible, we can satisfy both strategies. regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: clear() && collection proxy && RemovalAware
Sorry, I don't wanna be boring... Armin Waibel wrote: Hi Edson, I'm not familiar with the proxy stuff, so be patience... [EMAIL PROTECTED] wrote: Is this already in CVS? This fix is correct? Thanks, Edson Richter After some research, I've found an implementation that works: public void clear() { Collection coll; if(getData()instanceof ManageableCollection) { getData() will materialize the whole collection on each clear call. Is this the expected behaviour or should we check loading status before perfrom your changes? regards, Armin getData().clear(); // ECER: assure it will notify all being removed, necessary for RemovalAware classes... } else { // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } } Could someone cofirm/fix this in CVS? Thanks, Edson Richter Edson Carlos Ericksson Richter wrote: I think I and a co-worker (Igor) found a little bug in collection proxy. When using RemovalAware... as class for a collection descriptor, calling clear() in the collection don't register the objects for deletion. The answer is the clear implementation in CollectionProxyDefaultImpl: public void clear() { Collection coll; // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } I think the right method should be: public void clear() { Collection coll; getData().clear(); // ECER: assure it will notify all being removed, necessary for RemovalAware classes... // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } Could you analize and report if this is right? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: clear() && collection proxy && RemovalAware
After some research, I've found an implementation that works: public void clear() { Collection coll; if(getData()instanceof ManageableCollection) { getData().clear(); // ECER: assure it will notify all being removed, necessary for RemovalAware classes... } else { // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } } Could someone cofirm/fix this in CVS? Thanks, Edson Richter Edson Carlos Ericksson Richter wrote: I think I and a co-worker (Igor) found a little bug in collection proxy. When using RemovalAware... as class for a collection descriptor, calling clear() in the collection don't register the objects for deletion. The answer is the clear implementation in CollectionProxyDefaultImpl: public void clear() { Collection coll; // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } I think the right method should be: public void clear() { Collection coll; getData().clear(); // ECER: assure it will notify all being removed, necessary for RemovalAware classes... // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } Could you analize and report if this is right? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
clear() && collection proxy && RemovalAware
I think I and a co-worker (Igor) found a little bug in collection proxy. When using RemovalAware... as class for a collection descriptor, calling clear() in the collection don't register the objects for deletion. The answer is the clear implementation in CollectionProxyDefaultImpl: public void clear() { Collection coll; // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } I think the right method should be: public void clear() { Collection coll; getData().clear(); // ECER: assure it will notify all being removed, necessary for RemovalAware classes... // BRJ: use an empty collection so isLoaded will return true try { coll = (Collection) getCollectionClass().newInstance(); } catch (Exception e) { coll = new ArrayList(); } setData(coll); _size = 0; } Could you analize and report if this is right? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need help to auto-retrieve some individuals
Unless your Father has a very large number of children (as can occur in a Construction and the elements of construction in a price building system), you will find easier to get all childrens and implements two business methods in your Father bean: getFemaleChildrens() and getMaleChildrens(). So, you will have three ways to get the data you want, withou need to execute more than two selects on database. If you use JavaBeans based programming, when OJB call setChild, you can separate males and females, and kee each in theyr own list... Just my 2c, Edson Richter [EMAIL PROTECTED] wrote: Hi all, Letâs say we have an object name Father, who has a Child class collection (aggregate association). With the right repository settings (autoretrieve= true etc.) every time we "load" a father from the database, the children will be instantiated (they may be proxies or materialized). Hereâs our ignorance: when we retrieve a father we need the retrieved children collection, to be just a subset of the all fatherâs children collection. The children are those with a any given attribute set to a any given value (let say just those children with gender attribute set to female). This is just like having a filter or criteria setting at the owned collection level. Please pay attention to the fact we do not want to filter the fathers based in some children attributes. We need retrieve all fathers, just filtering some children. We are aware we could retrieve the father an then iterate the collection discarding the children we do not need, but we need this to become a common feature for our classes, not just a business logic for a single app, therefore we would like to know how to handle this in general. Thanks in advance, Gustavo Faerman. Buenos Aires, Argentina - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ResourceClosedException
Are you trying to iterate over the list after calling a broker.close()? Richter Keith Rogers wrote: I'm developing a web application using OJB, and every now and then I have the ResourceClosedException come up when iterating over a list. I think I understand what the exception means, but I'm pretty sure that the transaction I queried for the list in is not closed or aborted while I am iterating over it (and has been joined by the iterating thread) Can some of you fine people give me some pointers for things I should look out for that might cause this error? thanks, Keith The information in this e-mail is confidential and intended to be solely for the use of the addressee(s) and may contain copyright and/or legally privileged information. If you are not the addressee (or responsible for delivery of the message to the addressee) please e-mail us at [EMAIL PROTECTED] and delete the message from your computer; copying, distribution, use or disclosure of its contents is strictly prohibited. As Internet communications are capable of data corruption no responsibility is accepted for changes made to this message after it was sent. For this reason it may be inappropriate to rely on advice contained in any e-mail without obtaining written confirmation of it. In addition, no liability or responsibility is accepted for viruses and it is your responsibility to scan attachments (if any). Please note that for business purposes, outgoing and incoming emails from and to the company may be monitored and recorded. Mouchel Parkman UK Ltd, Registered in England at West Hall, Parvis Road, West Byfleet, Surrey UK KT14 6EZ Registered No : 1686040 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RC6 inheritance question.
For me works with 5 levels (huh, not so bad...). The only high WARNING here is if you try to get a report query using, let's say, max(someField), don't forget to iterate over results and watch the biggest (OJB will not do it for you: OJB will issue a select max(someField) for each table). May be this warning should be in docs, don't? Best regards, Edson Richter Jakob Braeuchi wrote: hi ziv, this also works for three levels. jakob Ziv Yankowitz wrote: Hi Folks, if I have a three level inheritance each mapped to it's own table, where Class C extends Class B extends Class A and I want to query Class C to bring all the data of all level is this possible? I know in two level inheritance this works. thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MtoN mapping
Are you using rc6 distro with proxies? Dynamic proxies? If yes, try latest CVS HEAD. There are several fixies related to M:N with multi keys, and collections with proxies. Best regards, Edson Richter Holger Auffinger wrote: Hi folks, need help implementing Non-Decomposed m:n Mapping. There are no Problems to write into database. While reading from database I got a null-pointer exception (in MtoNCollectionPrefetcher.java in 406) when using the steps from tutorial3. Code examples are welcome. Best regards Holger Auffinger ___ Die Lösungsschmiede GmbH Argonnenstr. 9 D-88250 Weingarten Telefon +49 (0)751-561 925-13 Telefax +49 (0)751-561 925-11 www.dieloesungsschmie.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
auto-update='true', proxy problems
A programmer at my side found a problem when storing objects that have collection with auto-update='true' or auto-update='link', with proxy='true'. The problem appear be the following piece of PerfistenceBrokerImpl.java: private void storeAndLinkOneToMany(boolean linkOnly, Object obj, CollectionDescriptor cod, Object referencedObjects, boolean insert) { if(referencedObjects == null) { return; } /* Only make sense to perform (link or/and store) real referenced objects or materialized collection proxy objects, because on unmaterialized collection nothing has changed. - if the collection is a collectionproxy and it's not already loaded no need to perform an update on the referenced objects - on insert we link and insert the referenced objects, because the proxy collection maybe "inherited" from the object before the PK was replaced */ if(insert || !(referencedObjects instanceof CollectionProxyDefaultImpl && !((CollectionProxyDefaultImpl) referencedObjects).isLoaded())) { Iterator it = getCollectionIterator(cod, referencedObjects); Object refObj; while(it.hasNext()) { refObj = it.next(); // set FK in refObj if it is materialized if(ProxyHelper.isMaterialized(refObj)) { ClassDescriptor refCld = getClassDescriptor(ProxyHelper.getRealClass(refObj)); link(refObj, refCld, cod, obj, insert); // if enabled cascade store and not only link, store the refObj if(!linkOnly && cod.getCascadingStore() == CollectionDescriptor.CASCADE_OBJECT) { store(refObj); } } } } } As specified in link method javadoc, the refObj must be a real object (no proxies allowed). So the method throws exception. Changing the code to the following will work fine: private void storeAndLinkOneToMany(boolean linkOnly, Object obj, CollectionDescriptor cod, Object referencedObjects, boolean insert) { if(referencedObjects == null) { return; } /* Only make sense to perform (link or/and store) real referenced objects or materialized collection proxy objects, because on unmaterialized collection nothing has changed. - if the collection is a collectionproxy and it's not already loaded no need to perform an update on the referenced objects - on insert we link and insert the referenced objects, because the proxy collection maybe "inherited" from the object before the PK was replaced */ if(insert || !(referencedObjects instanceof CollectionProxyDefaultImpl && !((CollectionProxyDefaultImpl) referencedObjects).isLoaded())) { Iterator it = getCollectionIterator(cod, referencedObjects); Object refObj; while(it.hasNext()) { refObj = it.next(); // set FK in refObj if it is materialized if(ProxyHelper.isMaterialized(refObj)) { if(ProxyHelper.isProxy(refObj)) { refObj = ProxyHelper.getRealObject(refObj); } ClassDescriptor refCld = getClassDescriptor(ProxyHelper.getRealClass(refObj)); link(refObj, refCld, cod, obj, insert); // if enabled cascade store and not only link, store the refObj if(!linkOnly && cod.getCascadingStore() == CollectionDescriptor.CASCADE_OBJECT) { store(refObj); } } } } } Could someone confirm, and if possible, fix this in CVS HEAD? Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
1:N, auto-update='false'
Appear that latest CVS Head is assuming auto-update='false' as auto-update='link'. Is this the correct behaviour? It should not be auto-update='none'? I've debugged OJB and seen this behaviour. I will need to fix all my repository files from auto-update='false' to auto-update='none'? Thanks for any tips, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proxy & toString still return "unmaterialized proxy for..."
Ok, but I think the right behaviour is call toString, not returning a "unmaterialized proxy...". IMHO, If other complain, will be easy to track where the real problem is. Thanks by fast response. Edson Richter Thomas Dudziak wrote: On Tue, 6 Apr 2004, Edson Carlos Ericksson Richter wrote: On IndirectionHandler, method invoke. Hmm, right. The problem was vice versa; I remember now why I didn't change that method right away. There was a reason why this handling is in the invoke method. Someplace within OJB an (implicit) call to toString within a log message must be replaced by using the ProxyHelper.toString method, but I couldn't find the communication about it in the mail archives ... I can change it but there will be some complaining from other people ;-) Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Proxy & toString still return "unmaterialized proxy for..."
On IndirectionHandler, method invoke. Thomas Dudziak wrote: I'll fix it ASAP if you can provide with the location within OJB where toString is called. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MtoN and multi-key indirection table trouble
Yes, Armin. You are absolute right. Another developer added into my class-descriptor another attribute to make inheranche works (different objects extends another one, and have same PK). But he don't changed my collection-descriptor, so I had 3 fields in PK, but only 2 in the collection descriptor. I made the correction, and it's working fine. Sorry by inconvenience. Suggestion: why not enumerate the PK in beans and the referenced fields in collection descriptor on the message when occur the AIOOBE? Richter Armin Waibel wrote: Hi Edson, that's really strange. I add a new test case two weeks ago called M2NTest. This test handle a m:n relation between Movie (2 PK) and Actor (1 PK) this test pass. I will try to locally increase the number of PK in each object, now Movie has 3 PK and Actor has 2 PK. All tests pass without problems. I will check in the modified test soon. Take care of the order of PK fields in your class-descriptors and in the indirection table. Maybe this cause your problems. regards, Armin Edson Carlos Ericksson Richter wrote: Sorry by reposting, but I'm in real trouble here... If I make a M:N without indirection works fine (in real, it's a 1:N:1). There is any other info (I already sent the collection-descriptors some time ago) I can send to help debug this? TIA, Edson Richter [EMAIL PROTECTED] wrote: Hi! I'm using latest CVS Head (of about 5 hours ago) and a multi-key M:N with indirection table, and still getting the AIOOBE. In M side I have 3 fields in PK, and in N side I have 2 fields in PK. The stacktrace for the error is: Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.appendJoinEqualities(SqlQueryStatement.java:2000) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendJoin(SqlQueryStatement.java:1446) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendTableWithJoins(SqlQueryStatement.java:1429) at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.getStatement(SqlSelectStatement.java:243) at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:151) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:275) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74) at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:183) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1810) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1321) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1432) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MtoN and multi-key indirection table trouble
Yes, I'll do that right now. I think I'm under overpressure (this word exists??? ;-), and maybe I`m loosing something (the major probability is this). Thanks Armin, Richter Armin Waibel wrote: Hi Edson, that's really strange. I add a new test case two weeks ago called M2NTest. This test handle a m:n relation between Movie (2 PK) and Actor (1 PK) this test pass. I will try to locally increase the number of PK in each object, now Movie has 3 PK and Actor has 2 PK. All tests pass without problems. I will check in the modified test soon. Take care of the order of PK fields in your class-descriptors and in the indirection table. Maybe this cause your problems. regards, Armin Edson Carlos Ericksson Richter wrote: Sorry by reposting, but I'm in real trouble here... If I make a M:N without indirection works fine (in real, it's a 1:N:1). There is any other info (I already sent the collection-descriptors some time ago) I can send to help debug this? TIA, Edson Richter [EMAIL PROTECTED] wrote: Hi! I'm using latest CVS Head (of about 5 hours ago) and a multi-key M:N with indirection table, and still getting the AIOOBE. In M side I have 3 fields in PK, and in N side I have 2 fields in PK. The stacktrace for the error is: Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.appendJoinEqualities(SqlQueryStatement.java:2000) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendJoin(SqlQueryStatement.java:1446) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendTableWithJoins(SqlQueryStatement.java:1429) at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.getStatement(SqlSelectStatement.java:243) at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:151) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:275) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74) at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:183) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1810) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1321) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1432) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Proxy & toString still return "unmaterialized proxy for..."
Subject say all... Thanks, Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MtoN and multi-key indirection table trouble
Sorry by reposting, but I'm in real trouble here... If I make a M:N without indirection works fine (in real, it's a 1:N:1). There is any other info (I already sent the collection-descriptors some time ago) I can send to help debug this? TIA, Edson Richter [EMAIL PROTECTED] wrote: Hi! I'm using latest CVS Head (of about 5 hours ago) and a multi-key M:N with indirection table, and still getting the AIOOBE. In M side I have 3 fields in PK, and in N side I have 2 fields in PK. The stacktrace for the error is: Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement$Join.appendJoinEqualities(SqlQueryStatement.java:2000) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendJoin(SqlQueryStatement.java:1446) at org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement.appendTableWithJoins(SqlQueryStatement.java:1429) at org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement.getStatement(SqlSelectStatement.java:243) at org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl.getPreparedSelectStatement(SqlGeneratorDefaultImpl.java:151) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:275) at org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74) at org.apache.ojb.broker.accesslayer.RsIterator.(RsIterator.java:183) at org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1810) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1321) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1432) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:300) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to do a Distinct on just one Column? (non PK)
No, OJB will not return ur objects, but a Object[][] (first dimensions is rows, second is columns). I think if you need object materialized, you could use some kind of QueryBySql (besides I never used it)... Look this too. Best regards, Richter McCaffrey, John G. wrote: I was going to look in to that, as a plan B! If I use a ReportQuery, can I still get OJB to return a collection of objects? (will it still iterate over the ResultSet and build my VOs, or will it just return a bunch of String[]?) Thanks! -Original Message- From: Edson Carlos Ericksson Richter [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 11:49 AM To: OJB Users List Subject: Re: Is it possible to do a Distinct on just one Column? (non PK) AFAIK, you will need a ReportQuery. Richter McCaffrey, John G. wrote: I need to do a query and retrive a filtered set of data. Basically I have a composite primary key item_code Price_Area_code price_bracket_cd effect_date an item can be in multiple price_areas , and will have historical entries over time. to get the current row, I have to check effect_date > current date and end_effect_date < current date what I need to do is get a list of item_codes in a given price_area, regardless of how many brackets entries there are select a distnct (item_code) where price_area = 1 and effect_date how can I tell ojb which column I want to make distinct? Could I do a subselect? select * from xx_table a where item_code in(select (distinct) where price_area = 1 and effect_date ) thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is it possible to do a Distinct on just one Column? (non PK)
AFAIK, you will need a ReportQuery. Richter McCaffrey, John G. wrote: I need to do a query and retrive a filtered set of data. Basically I have a composite primary key item_code Price_Area_code price_bracket_cd effect_date an item can be in multiple price_areas , and will have historical entries over time. to get the current row, I have to check effect_date > current date and end_effect_date < current date what I need to do is get a list of item_codes in a given price_area, regardless of how many brackets entries there are select a distnct (item_code) where price_area = 1 and effect_date how can I tell ojb which column I want to make distinct? Could I do a subselect? select * from xx_table a where item_code in(select (distinct) where price_area = 1 and effect_date ) thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probleml with Mapping Inheritance Hierarchies
Yes, I already have done it. There is no chance to include the class name into identity object when checking the PK id? Best regards, Edson Richter Jakob Braeuchi wrote: hi edson, the Identity uses pk only. so you'd have to declare ojbConcreteClass part of the pk. jakob Edson Carlos Ericksson Richter wrote: I did it diferencing them by the class name (I put the ojbConcreteClass - I know this is not really needed, but I think any identifier is ok). So, there is no chance to OJB identify (by the complete class name) that the classes are not same for same PK id, and then use correct class-descriptor and instantiate correct class? Jakob Braeuchi wrote: hi edson, this is imo a know fact. ojb requires to pk to be unique within a class hierarchy. let's assume you have a class D referencing 1:1 an A identified by id =1. if this id is not unique in the class hierarchy, then ojb does not know if it's an A, B or C. imo there's no other way than to define th pk unique. jakob Edson Carlos Ericksson Richter wrote: Of course, I'll try (all package test). public class A { public int id; public String description; } public class B extends A { public double value; } public class C extends A { public Date value; } class="test.C" table="tableC"> name="id" column="id" jdbc-type="INTEGER" primary-key="true"/> name="description" column="description" jdbc-type="VARCHAR"/> name="value" column="value" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" jdbc-type="TIMESTAMP"/> Now fill with data: insert into tableB (id, description, value) values (1, 'testB1', 123.45) insert into tableB (id, description, value) values (2, 'testB2', 234.56) insert into tableC (id, description, value) values (1, 'testC1', '2004-04-01 00:00:00.000') insert into tableC (id, description, value) values (2, 'testC2', '2004-04-01 00:00:00.000') Then try to read all with query by criteria, or something, over test.A class. You will get a collection of 4 objects B or 4 objects C (depending what the databased returned first!!!). The problem here as far as I can see is because either B and C has exactly same PK definition and same values for PKs. As I related, if I add some kind of field to diferentiate the PK, result is right. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probleml with Mapping Inheritance Hierarchies
I did it diferencing them by the class name (I put the ojbConcreteClass - I know this is not really needed, but I think any identifier is ok). So, there is no chance to OJB identify (by the complete class name) that the classes are not same for same PK id, and then use correct class-descriptor and instantiate correct class? Jakob Braeuchi wrote: hi edson, this is imo a know fact. ojb requires to pk to be unique within a class hierarchy. let's assume you have a class D referencing 1:1 an A identified by id =1. if this id is not unique in the class hierarchy, then ojb does not know if it's an A, B or C. imo there's no other way than to define th pk unique. jakob Edson Carlos Ericksson Richter wrote: Of course, I'll try (all package test). public class A { public int id; public String description; } public class B extends A { public double value; } public class C extends A { public Date value; } class="test.C" table="tableC"> name="id" column="id" jdbc-type="INTEGER" primary-key="true"/> name="description" column="description" jdbc-type="VARCHAR"/> name="value" column="value" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" jdbc-type="TIMESTAMP"/> Now fill with data: insert into tableB (id, description, value) values (1, 'testB1', 123.45) insert into tableB (id, description, value) values (2, 'testB2', 234.56) insert into tableC (id, description, value) values (1, 'testC1', '2004-04-01 00:00:00.000') insert into tableC (id, description, value) values (2, 'testC2', '2004-04-01 00:00:00.000') Then try to read all with query by criteria, or something, over test.A class. You will get a collection of 4 objects B or 4 objects C (depending what the databased returned first!!!). The problem here as far as I can see is because either B and C has exactly same PK definition and same values for PKs. As I related, if I add some kind of field to diferentiate the PK, result is right. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probleml with Mapping Inheritance Hierarchies
Of course, I'll try (all package test). public class A { public int id; public String description; } public class B extends A { public double value; } public class C extends A { public Date value; } class="test.C" table="tableC"> name="id" column="id" jdbc-type="INTEGER" primary-key="true"/> name="description" column="description" jdbc-type="VARCHAR"/> name="value" column="value" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" jdbc-type="TIMESTAMP"/> Now fill with data: insert into tableB (id, description, value) values (1, 'testB1', 123.45) insert into tableB (id, description, value) values (2, 'testB2', 234.56) insert into tableC (id, description, value) values (1, 'testC1', '2004-04-01 00:00:00.000') insert into tableC (id, description, value) values (2, 'testC2', '2004-04-01 00:00:00.000') Then try to read all with query by criteria, or something, over test.A class. You will get a collection of 4 objects B or 4 objects C (depending what the databased returned first!!!). The problem here as far as I can see is because either B and C has exactly same PK definition and same values for PKs. As I related, if I add some kind of field to diferentiate the PK, result is right. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Probleml with Mapping Inheritance Hierarchies
Sorry by reposting, but appear that my last post wasn't to the list... --- I can reproduce this problem with OJB 1.0rc6. Appear that when two or more tables with same PKs, with identical values for their PKs have the following behaviour: a) Get Identity for the first object. Get the object by Identity. Put it in the ChainingIterator b) Get Identity for second object. Since this identity is already (remeber, the values of the PKs are the same), don't get the object again. Just put it again. c) and so on. I don't know if this is the real steps done inside OJB (I tryied to debug, but I must admit it's so much complex to me), but as far as I can get debugged, is this that is occuring. I think that the test should be made against the same PK and getClass().getName(). If two are same, then the object is already inside (and, if user asked for distinct, should not add repeated anyway). Otherwise, should exect a getByIdentity using the correct table. What do you think all? Can someone test the extent tests using values in different tables with same PK? As workaround, I added ojbConcreteClass to my class-descriptor as PK, and works fine (but I think it's a very, really bad solution). Behaviour is same with or without proxies. Best regards, Edson Richter Edson Carlos Ericksson Richter wrote: Hi! I don't know if this solves your problem, but AFAIK, you can't mix with , as you have done in class-descriptor for A class. More, I have no luck in using extent-class using a Interface as super-object. Have you tried an ABAbstractClass (I'm just trying a sidekick)? Best regards, Edson Richter Björn Voigt wrote: OK, I have still no solution for my inheritance mapping problem. There are my Classes A,B and C implementing the ABInterface, C and B extend from A. I want to map each class to a distinct tables, but on Multiple Joined Tables. The c an b table have its own primary column "b_id" and "c_id" and both a foreign key "a_id" referenes the a table. Table A: Table B: id | some_value_from_a b_id | a_id | some_value_from_b +--- --+--+--- 1 | 1000100 |1 | 1001 2 | 2000 Table C: c_id | a_id | some_value_from_c --+--+--- 101 |2 | 2002 Ok, if I query the ABInterface I want have two instances, one of B and one of C, something like this: instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But I get also instances of A, a query has this result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But thats not all: instance into b values (1, 1, 1001); instead of: instance into b values (100, 1, 1001); has the following query-result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.A id:1 a_value:1000 instance test.C id:2 a_value:2000 c_value:2002 if b_id equals to an id of the a-table, or b_id equals to a c_id in c-table, the result is another. I am using rc5 and would be very happy, if you can help me or give me an working example. Björn Voigt Here follows my complete source code: package test; public class A implements ABInterface{ int id; int someValueFromA; public String toString() { return this.getClass() + " id:" +id +" a_value:" + someValueFromA; } } package test; public class B extends A { int b_id; int someValueFromB; public String toString() { return super.toString() + " b_value:" + someValueFromB; } } package test; public class C extends A { int c_id; int someValueFromC; public String toString() { return super.toString() + " c_value:" + someValueFromC; } } primarykey="true" autoincrement="true" /> primarykey="true" autoincrement="true" /> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Insert instead of update generated in RC6
I agree with you. Conversion is one way to get things working, as OJB executing a select to test with already exists a record with PK 0 is another way. The auto-increment field should be tested when in PK that is inherently not-null. In this case, there is no other way (exception if we create a nullable attribute for field-descriptors). About the 0 in multi-pk fields, I agree. My comments look about single PK fields. I'm just trying to get a new point of view in the discussion, because I use largelly int in PK, and changes in this behaviour can affect our projects (fortunatelly, since we never use 0 as valid value for PKs, we had no problems like reported by you)... My propose is not change current behaviour, but add non-invasive options to manipulate behaviour of OJB. May be docs should point the developer to use the conversion when he want's the mapping from 0 to null, and make OJB doens't making this conversion automatically, BUT in case of auto-increment fields I don't see much scape. A declared int field will be 0 even if the value is not set... So how can I inform OJB that this is a new field? Should we take in count that this is a multi-pk, 0 is not converted? Maybe the simple to understand, an less intrusive make OJB: a) don't convert automatically 0 to null; b) when auto-increment is set, consider 0 as new auto-calculated value. c) convert 0 to null and vice-versa when using int2IntegerConversion. Best regards, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Insert instead of update generated in RC6
Let me make some comments: Using primitive, then there is no other way to specify a nullability. I think we can take to the developer a choice to use nullable and primitive int but keep it always warned that 0 will save NULL in the database, and a NULL in database will, in turn, be converted to a 0 in primitive field. I think a WARN in docs is sufficient. Maybe a future "nullable" attribute in field-descritor could help, with values "zeroIsNull", "negativeIsNull", "false", "true" (where false means default action: 0 == 0, -1 == -1, and true means actual behaviour 0==null. The other options talk by itself). But in PK, that doesn't allow NULL, if the primitive field is 0 we can have two situations: if the mapping tell us that there is an auto-increment field, then user doesn't want a real 0, but a newly inserted field. Auto-increments, as far as I have seen don't use 0 as starting point. As interesting history, some weeks ago a beginner developer asked me about a product type codes: 0 - Service, 1 - Resale product, 2 - Own factoried product. I said to him: never, ever, use 0 as PK to avoid problems for understanding. In meantime, another begginer at his side said "0, in my point of view, is expected to means nothing, so I'll never use it as value for a PK". I'm tending to agree with this vision. So, OJB could test if the field is auto-increment, and, if true, then assume that it's a new record being inserted. If false, assume that it's a 0 since there is no NULLs in PKs, and should be a update if already exists. This change, as far as I can see, will not change the current behaviour of OJB, right? Just my 2 cents, Edson Richter Armin Waibel wrote: Guido Beutler wrote: Hi, changing public boolean representsNull(FieldDescriptor fld, Object aValue) { . if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0))) { >>> result = fld.getPersistentField().getType().isPrimitive() && fld.isPrimaryKey(); } return result; } into result = fld.getPersistentField().getType().isPrimitive() && ! fld.isPrimaryKey(); seems to fix my problem, updates are generated now and insert's work too. One of our OJB Guru's like Armin should take a look on it. ;-) I just made some small tests and can not be sure that this don't produce some side effects. If my fix is correct, updates never worked for objects with 0 values at primary key fields. Maybe I'm on the wrong tack, but I don't figure out the change. This method should return 'true' - when the field as number of '0' - and the field is primitive (short in your case) - and the field-descriptor is declared as PK In your patch you return true, when the field was not declared as PK. But in that case all values are valid ('0' too). Your patch do the opposite from what I expected. Maybe I'm completely confused ;-) Again, if you have a class with primitive short field, declared as PK with value '0', OJB assume that the field is nullified and because PK couldn't be 'null' OJB assume the given object was new. Hope I don't make a fool of oneself ;-) regards, Armin best regards, Guido Guido Beutler wrote: Guido Beutler wrote: Armin Waibel wrote: do you use anonymous keys? If so where? >> Do you remember our DataSource problem with 3.2.2.RC3 with missing >> results? No, can you describe this problem again? Should I update to JBoss 3.2.3 and run the tests again? we had the problem, that not all objects were returned by OJB. This seemed to be a side effect of the eager-release flag. After Update to JBoss 3.2.3 the problem disapeared. Maybe that the bahavior of our current problem is different in 3.2.3. I'll put some debug gcode into PersistenceBroker and see what's going on during insert/update. best regards, Guido Hi, I added some debug code to PersistenceBrokerImpl : public void store(Object obj) throws PersistenceBrokerException { ... boolean doInsert = serviceBrokerHelper().hasNullPKField(cld, obj); returns true. The reason seems to be BrokerHelper.representsNull : public boolean representsNull(FieldDescriptor fld, Object aValue) { . if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0))) { result = fld.getPersistentField().getType().isPrimitive() && fld.isPrimaryKey(); } return result; } returns true for my SMALLINT objects if the value is 0. But 0 is a leagal value for SMALLINT PK attributes. After that PersistenceBrokerImpl.store checks the cache: /* if PK values are set, lookup cache or db to see whether object needs insert or update */ if (!doInsert) { doInsert = objectCache.lookup(oid) == null && !serviceBrokerHelper().doesExist(cld, oid, obj); } because of doInsert is still true (I
Re: Still Probleml with Mapping Inheritance Hierarchies
I can reproduce this problem with OJB 1.0rc6. Appear that when two or more tables with same PKs, with identical values for their PKs have the following behaviour: a) Get Identity for the first object. Get the object by Identity. Put it in the ChainingIterator b) Get Identity for second object. Since this identity is already (remeber, the values of the PKs are the same), don't get the object again. Just put it again. c) and so on. I don't know if this is the real steps done inside OJB (I tryied to debug, but I must admit it's so much complex to me), but as far as I can get debugged, is this that is occuring. I think that the test should be made against the same PK and getClass().getName(). If two are same, then the object is already inside (and, if user asked for distinct, should not add repeated anyway). Otherwise, should exect a getByIdentity using the correct table. What do you think all? Can someone test the extent tests using values in different tables with same PK? As workaround, I added ojbConcreteClass to my class-descriptor as PK, and works fine (but I think it's a very, really bad solution). Behaviour is same with or without proxies. Best regards, Edson Richter Edson Carlos Ericksson Richter wrote: Hi! I don't know if this solves your problem, but AFAIK, you can't mix with , as you have done in class-descriptor for A class. More, I have no luck in using extent-class using a Interface as super-object. Have you tried an ABAbstractClass (I'm just trying a sidekick)? Best regards, Edson Richter Björn Voigt wrote: OK, I have still no solution for my inheritance mapping problem. There are my Classes A,B and C implementing the ABInterface, C and B extend from A. I want to map each class to a distinct tables, but on Multiple Joined Tables. The c an b table have its own primary column "b_id" and "c_id" and both a foreign key "a_id" referenes the a table. Table A: Table B: id | some_value_from_a b_id | a_id | some_value_from_b +--- --+--+--- 1 | 1000100 |1 | 1001 2 | 2000 Table C: c_id | a_id | some_value_from_c --+--+--- 101 |2 | 2002 Ok, if I query the ABInterface I want have two instances, one of B and one of C, something like this: instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But I get also instances of A, a query has this result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But thats not all: instance into b values (1, 1, 1001); instead of: instance into b values (100, 1, 1001); has the following query-result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.A id:1 a_value:1000 instance test.C id:2 a_value:2000 c_value:2002 if b_id equals to an id of the a-table, or b_id equals to a c_id in c-table, the result is another. I am using rc5 and would be very happy, if you can help me or give me an working example. Björn Voigt Here follows my complete source code: package test; public class A implements ABInterface{ int id; int someValueFromA; public String toString() { return this.getClass() + " id:" +id +" a_value:" + someValueFromA; } } package test; public class B extends A { int b_id; int someValueFromB; public String toString() { return super.toString() + " b_value:" + someValueFromB; } } package test; public class C extends A { int c_id; int someValueFromC; public String toString() { return super.toString() + " c_value:" + someValueFromC; } } primarykey="true" autoincrement="true" /> primarykey="true" autoincrement="true" /> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)
An un-elegant way to do same withou select count: try { String x = myXobject.getY().toString(); } catch(NullPointerException e) { ... do something because there is no Y... } The question is: what cost more? Doing a select count(*) over a indexed (primary key) field, with all network overhead, or catching a NPE? Best regards, Edson Richter Jakob Braeuchi wrote: hi edson, executing an additional count on each reference proxy is quite expensive. but i have to admit, i do not have a better solution right now :( jakob Edson Carlos Ericksson Richter wrote: Still with problems when using a 1:0..1 mapping + proxy="dynamic". The problem is: when making a reference between two objects (X:Y) and there can be 0 or 1 object in Y side, Y must resturn NULL if it don't exists in database, and the object itself if there is 1 object in database. The rule is maintained using same PK for two tables, a foreign key to guarantee data integrity, and a NULL allowed in the X side to allow 0 values in Y side. the error is seen when using "proxy='dynamic'" because OJB set, internally, the value to a dynamic proxy. In the code, when you test "myXobject.getY()==null" the result is always false, because getY is returnin a non-materialized proxy. The following code will always throw NPE when are 0 Y objects for a X object (but if proxy="false", there is no error): if(myXobject.getY()!=null) { // It always get into here, even when there is no Y value!!! System.out.println(myXobject.getY().getId()); // the previous line will throw NPE, because when acessisng getId(), OJB will try to materialize, // since there is no Y object, will try to execute getId() over a null materialized. } This sayid, I think OJB should execute a count when using a reference as proxy, and when there is 0 object, return null, not a unmaterialized proxy (so the null test in code above will have same behaviour as if it's not proxy). What you say? Best regards, Edson Richter Best regards, Edson Richter Armin Waibel wrote: Hi Edson, [EMAIL PROTECTED] wrote: Hmmm, what about the "1:0..1 and proxies test for null is always false" and the "afterStore not being called for collections"? Are they fixed too? Sorry I don't know. While refactoring the handling of the auto-xxx code I do my best, but I don't turn my attention to these problems. Could you review/test the rc6/CVS code and repost the problematic spots? regards, Armin Best regards, Edson Richter Dear all, We've got a new release! Given we find no showstoppers during the next week we will approach the Project Management Committee (PMC) of the db.apache.org project to get approval to relabel this release as the final 1.0 version. Armin worked hard to get our regression testbed rocksolid. We now have more than 600 testcases covering all major areas of the framework! I'm confident that this testsuite will help us to maintain and even increse the reliability of our code from release to release. Thanks to all who helped and contributed to this release! --Thomas From the release notes: - Release 1.0 rc6 - NEW FEATURES: - NOTES: - Repository.dtd has changed, don't forget to replace this file - Upgraded to the new Apache License, Version 2.0 - No support for HSQLDB 1.7.2RC1 yet - No support for Torque 3.1 yet - Add new PersistenceBrokerFactory implementation for use in managed environments when *only* the PB-api was used and participation in JTA transaction via Synchronization interface is needed. - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl. Used to enable a simple synchronization mechanism to keep cache in sync with DB - Add new attribute values for reference-/collection-descriptor auto-update/-delete attribute. Now we have five possible values: none, link, object, true, false. The true, false values are now deprecated but will NOT be removed in near future (so don't panic!). CHANGES: - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was INTEGER but needs BIGINT to support Long on java side - no longer throw an exception when calling abortTransaction more than one time or an internal rollback (by ConnectionManager on the used connection) was already done - Add object-cache tag in standard jdbc-connection-descriptor in repository_database.xml to enable new 'autoSync' property of ObjectCacheDefaultImpl for all operations made by this DB connection - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl (handle with care ;-)) - odmg-api implementation, disable restore of transient objects on transaction abort, because we can't really restore the whole object with all references - now using ANTLR 2.7.2 and Unicode support in OQL queries
1:0..1 mappings and dynamic proxies (was Re: [ann] new release 1.0.RC6)
Still with problems when using a 1:0..1 mapping + proxy="dynamic". The problem is: when making a reference between two objects (X:Y) and there can be 0 or 1 object in Y side, Y must resturn NULL if it don't exists in database, and the object itself if there is 1 object in database. The rule is maintained using same PK for two tables, a foreign key to guarantee data integrity, and a NULL allowed in the X side to allow 0 values in Y side. the error is seen when using "proxy='dynamic'" because OJB set, internally, the value to a dynamic proxy. In the code, when you test "myXobject.getY()==null" the result is always false, because getY is returnin a non-materialized proxy. The following code will always throw NPE when are 0 Y objects for a X object (but if proxy="false", there is no error): if(myXobject.getY()!=null) { // It always get into here, even when there is no Y value!!! System.out.println(myXobject.getY().getId()); // the previous line will throw NPE, because when acessisng getId(), OJB will try to materialize, // since there is no Y object, will try to execute getId() over a null materialized. } This sayid, I think OJB should execute a count when using a reference as proxy, and when there is 0 object, return null, not a unmaterialized proxy (so the null test in code above will have same behaviour as if it's not proxy). What you say? Best regards, Edson Richter Best regards, Edson Richter Armin Waibel wrote: Hi Edson, [EMAIL PROTECTED] wrote: Hmmm, what about the "1:0..1 and proxies test for null is always false" and the "afterStore not being called for collections"? Are they fixed too? Sorry I don't know. While refactoring the handling of the auto-xxx code I do my best, but I don't turn my attention to these problems. Could you review/test the rc6/CVS code and repost the problematic spots? regards, Armin Best regards, Edson Richter Dear all, We've got a new release! Given we find no showstoppers during the next week we will approach the Project Management Committee (PMC) of the db.apache.org project to get approval to relabel this release as the final 1.0 version. Armin worked hard to get our regression testbed rocksolid. We now have more than 600 testcases covering all major areas of the framework! I'm confident that this testsuite will help us to maintain and even increse the reliability of our code from release to release. Thanks to all who helped and contributed to this release! --Thomas From the release notes: - Release 1.0 rc6 - NEW FEATURES: - NOTES: - Repository.dtd has changed, don't forget to replace this file - Upgraded to the new Apache License, Version 2.0 - No support for HSQLDB 1.7.2RC1 yet - No support for Torque 3.1 yet - Add new PersistenceBrokerFactory implementation for use in managed environments when *only* the PB-api was used and participation in JTA transaction via Synchronization interface is needed. - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl. Used to enable a simple synchronization mechanism to keep cache in sync with DB - Add new attribute values for reference-/collection-descriptor auto-update/-delete attribute. Now we have five possible values: none, link, object, true, false. The true, false values are now deprecated but will NOT be removed in near future (so don't panic!). CHANGES: - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was INTEGER but needs BIGINT to support Long on java side - no longer throw an exception when calling abortTransaction more than one time or an internal rollback (by ConnectionManager on the used connection) was already done - Add object-cache tag in standard jdbc-connection-descriptor in repository_database.xml to enable new 'autoSync' property of ObjectCacheDefaultImpl for all operations made by this DB connection - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl (handle with care ;-)) - odmg-api implementation, disable restore of transient objects on transaction abort, because we can't really restore the whole object with all references - now using ANTLR 2.7.2 and Unicode support in OQL queries - now using ANT 1.6.0 - RelationshipPrefetcher no longer modifies auto-retrieve setting of Relationship-Descriptor. This may result in additional sql-queries but is safer in a multi-threaded environment. - Added column methods to Criteria. addColumnEqualTo, addColumnIn etc. The column parameter of these methods will not be translated during sql-generation. These methods are mainly used for internal purpose. BUG FIXES: Please refer to our Bug tracking site (http://issues.apache.org/scarab/servlet/scarab/) under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx to see details for a bug with id OJBxxx. - fix bug in MetadataManager, when 'per thread changes' is enabled and many different DescriptorRepo
Re: [ann] new release 1.0.RC6
If you can download sources, you could do a "bin\build jar-debug" that will generate the debugabble version. Richter Glenn Barnard wrote: Congratulations!!! I have a couple of questions... First, will it have a debuggable version? rc5 didn't (at least as far as I could see)? McCaffrey, John G. <[EMAIL PROTECTED]> and I have been working with OJB to get the primary key from a native sequence manager. John's using DB2 and I'm using MS SQL Server. Seems like John's solution works, but mine isn't (yet). When can we get our solutions included with the base code? From: Thomas Mahler <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: OJB Developers List <[EMAIL PROTECTED]>, OJB Users List <[EMAIL PROTECTED]> Subject: [ann] new release 1.0.RC6 Date: Sun, 28 Mar 2004 14:11:03 +0200 Dear all, We've got a new release! Given we find no showstoppers during the next week we will approach the Project Management Committee (PMC) of the db.apache.org project to get approval to relabel this release as the final 1.0 version. Armin worked hard to get our regression testbed rocksolid. We now have more than 600 testcases covering all major areas of the framework! I'm confident that this testsuite will help us to maintain and even increse the reliability of our code from release to release. Thanks to all who helped and contributed to this release! --Thomas From the release notes: - Release 1.0 rc6 - NEW FEATURES: - NOTES: - Repository.dtd has changed, don't forget to replace this file - Upgraded to the new Apache License, Version 2.0 - No support for HSQLDB 1.7.2RC1 yet - No support for Torque 3.1 yet - Add new PersistenceBrokerFactory implementation for use in managed environments when *only* the PB-api was used and participation in JTA transaction via Synchronization interface is needed. - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl. Used to enable a simple synchronization mechanism to keep cache in sync with DB - Add new attribute values for reference-/collection-descriptor auto-update/-delete attribute. Now we have five possible values: none, link, object, true, false. The true, false values are now deprecated but will NOT be removed in near future (so don't panic!). CHANGES: - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was INTEGER but needs BIGINT to support Long on java side - no longer throw an exception when calling abortTransaction more than one time or an internal rollback (by ConnectionManager on the used connection) was already done - Add object-cache tag in standard jdbc-connection-descriptor in repository_database.xml to enable new 'autoSync' property of ObjectCacheDefaultImpl for all operations made by this DB connection - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl (handle with care ;-)) - odmg-api implementation, disable restore of transient objects on transaction abort, because we can't really restore the whole object with all references - now using ANTLR 2.7.2 and Unicode support in OQL queries - now using ANT 1.6.0 - RelationshipPrefetcher no longer modifies auto-retrieve setting of Relationship-Descriptor. This may result in additional sql-queries but is safer in a multi-threaded environment. - Added column methods to Criteria. addColumnEqualTo, addColumnIn etc. The column parameter of these methods will not be translated during sql-generation. These methods are mainly used for internal purpose. BUG FIXES: Please refer to our Bug tracking site (http://issues.apache.org/scarab/servlet/scarab/) under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx to see details for a bug with id OJBxxx. - fix bug in MetadataManager, when 'per thread changes' is enabled and many different DescriptorRepository instances were used, gc can't collect unused instances because StatementManager doesn't release references to used DescriptorRepository instances. - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use a soft reference for the object wrapper of the cached object. Use a softreference for the cached object instead - fix bug in CacheDistributor (internal used ObjectCache implementation), each CacheDistributor instance have to held ObjectCache instances for the associated PersistenceBroker instance - fix documentation bug in ObjectCacheDefaultImpl, property 'timeout' use seconds instead of milliseconds - fix bug in new DList implementation (DListImpl_2), materialization of objects failed when DList instance itself was persisted (using db.bind(...)) and re-loaded within tx, but iteration over the list values was done outside of the tx - The bogus ODMG Distributed Lockmanagement feature has been replaced by a new Servlet based LockServer. Transaction isolation should now work properly even accross a cluster of JVMs. - fix bug in
Re: [ann] new release 1.0.RC6
Appear the afterStore stuff is in place, and operational (so, RemovalAwareXXX again working fine). Sorry if sometimes I'm so fast in reporting problems, but I tryied to keep our project tuned to latest OJB ever (maybe not best policy, but until today solved most our problems with bugs). Sometime this policy lend us to use a CVS Head that may be not complete, and areas with work-in-progress (like the afterXXX stuff) may be in "pending changes" state... Thanks. Armin Waibel wrote: Hi Edson, [EMAIL PROTECTED] wrote: Hmmm, what about the "1:0..1 and proxies test for null is always false" and the "afterStore not being called for collections"? Are they fixed too? Sorry I don't know. While refactoring the handling of the auto-xxx code I do my best, but I don't turn my attention to these problems. Could you review/test the rc6/CVS code and repost the problematic spots? regards, Armin Best regards, Edson Richter Dear all, We've got a new release! Given we find no showstoppers during the next week we will approach the Project Management Committee (PMC) of the db.apache.org project to get approval to relabel this release as the final 1.0 version. Armin worked hard to get our regression testbed rocksolid. We now have more than 600 testcases covering all major areas of the framework! I'm confident that this testsuite will help us to maintain and even increse the reliability of our code from release to release. Thanks to all who helped and contributed to this release! --Thomas From the release notes: - Release 1.0 rc6 - NEW FEATURES: - NOTES: - Repository.dtd has changed, don't forget to replace this file - Upgraded to the new Apache License, Version 2.0 - No support for HSQLDB 1.7.2RC1 yet - No support for Torque 3.1 yet - Add new PersistenceBrokerFactory implementation for use in managed environments when *only* the PB-api was used and participation in JTA transaction via Synchronization interface is needed. - Add new configuration property 'autoSync' to ObjectCacheDefaultImpl. Used to enable a simple synchronization mechanism to keep cache in sync with DB - Add new attribute values for reference-/collection-descriptor auto-update/-delete attribute. Now we have five possible values: none, link, object, true, false. The true, false values are now deprecated but will NOT be removed in near future (so don't panic!). CHANGES: - fix bug in internal table OJB_HL_SEQ, column type of MAX_ID was INTEGER but needs BIGINT to support Long on java side - no longer throw an exception when calling abortTransaction more than one time or an internal rollback (by ConnectionManager on the used connection) was already done - Add object-cache tag in standard jdbc-connection-descriptor in repository_database.xml to enable new 'autoSync' property of ObjectCacheDefaultImpl for all operations made by this DB connection - Allow infinite lifetime of cached objects in ObjectCacheDefaultImpl (handle with care ;-)) - odmg-api implementation, disable restore of transient objects on transaction abort, because we can't really restore the whole object with all references - now using ANTLR 2.7.2 and Unicode support in OQL queries - now using ANT 1.6.0 - RelationshipPrefetcher no longer modifies auto-retrieve setting of Relationship-Descriptor. This may result in additional sql-queries but is safer in a multi-threaded environment. - Added column methods to Criteria. addColumnEqualTo, addColumnIn etc. The column parameter of these methods will not be translated during sql-generation. These methods are mainly used for internal purpose. BUG FIXES: Please refer to our Bug tracking site (http://issues.apache.org/scarab/servlet/scarab/) under http://issues.apache.org/scarab/servlet/scarab/issues/id/OJBxxx to see details for a bug with id OJBxxx. - fix bug in MetadataManager, when 'per thread changes' is enabled and many different DescriptorRepository instances were used, gc can't collect unused instances because StatementManager doesn't release references to used DescriptorRepository instances. - fix bug in ObjectCacheDefaultImpl, it doesn't make sense to use a soft reference for the object wrapper of the cached object. Use a softreference for the cached object instead - fix bug in CacheDistributor (internal used ObjectCache implementation), each CacheDistributor instance have to held ObjectCache instances for the associated PersistenceBroker instance - fix documentation bug in ObjectCacheDefaultImpl, property 'timeout' use seconds instead of milliseconds - fix bug in new DList implementation (DListImpl_2), materialization of objects failed when DList instance itself was persisted (using db.bind(...)) and re-loaded within tx, but iteration over the list values was done outside of the tx - The bogus ODMG Distributed Lockmanagement feature has been replaced by a new Servlet based LockSe
Re: Still Probleml with Mapping Inheritance Hierarchies
Hi! I don't know if this solves your problem, but AFAIK, you can't mix with , as you have done in class-descriptor for A class. More, I have no luck in using extent-class using a Interface as super-object. Have you tried an ABAbstractClass (I'm just trying a sidekick)? Best regards, Edson Richter Björn Voigt wrote: OK, I have still no solution for my inheritance mapping problem. There are my Classes A,B and C implementing the ABInterface, C and B extend from A. I want to map each class to a distinct tables, but on Multiple Joined Tables. The c an b table have its own primary column "b_id" and "c_id" and both a foreign key "a_id" referenes the a table. Table A: Table B: id | some_value_from_a b_id | a_id | some_value_from_b +--- --+--+--- 1 | 1000100 |1 | 1001 2 | 2000 Table C: c_id | a_id | some_value_from_c --+--+--- 101 |2 | 2002 Ok, if I query the ABInterface I want have two instances, one of B and one of C, something like this: instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But I get also instances of A, a query has this result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.B id:1 a_value:1000 b_value:1001 instance test.C id:2 a_value:2000 c_value:2002 But thats not all: instance into b values (1, 1, 1001); instead of: instance into b values (100, 1, 1001); has the following query-result: instance test.A id:1 a_value:1000 instance test.A id:2 a_value:2000 instance test.A id:1 a_value:1000 instance test.C id:2 a_value:2000 c_value:2002 if b_id equals to an id of the a-table, or b_id equals to a c_id in c-table, the result is another. I am using rc5 and would be very happy, if you can help me or give me an working example. Björn Voigt Here follows my complete source code: package test; public class A implements ABInterface{ int id; int someValueFromA; public String toString() { return this.getClass() + " id:" +id +" a_value:" + someValueFromA; } } package test; public class B extends A { int b_id; int someValueFromB; public String toString() { return super.toString() + " b_value:" + someValueFromB; } } package test; public class C extends A { int c_id; int someValueFromC; public String toString() { return super.toString() + " c_value:" + someValueFromC; } } primarykey="true" autoincrement="true" /> primarykey="true" autoincrement="true" /> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
Thinking less abstract, the field names of PK in A object are same field names in B table, as the field names of PK in C are the same field names in B. So, if A has the fields A1, A2 (PKs), and C has fields C1, C2, C3 (PKs), then B has fields A1, A2, C1, C2, C3. So, the select will be: select * from A join B on A.A1 = B.A1 and A.A2 = B.A2 join C on C.C1 = B.C1 and C.C2 = B.C2 and C.C3 = B.C3 IMHO, the names of the fields are not important, but their position. The "pointing-to-this-class" should be understood as 1st PK is pointing to first field, and 2nd PK to the 2nd field. The first pointing-to-element should be mapped to 1st PK in the N element, the 2nd to the second PK, and the 3rd, to 3rd PK. As far as I can see, the MtoN must know the CDS of the M element and the N element, so the mapping could be done. Richter Edson Carlos Ericksson Richter wrote: The expected result is something like A<->B<->C Where A is M side has PK with 2 fields, C is N side has PK with 3 fields, B is indirection table, and has 5 fields. select * from A join B on A.field1 = B.field1 and A.field2 = B.field2 join C on C.field1 = B.field3 and C.field2 = B.field4 and C.field3 = B.field5 I expect this help. Edson Richter Jakob Braeuchi wrote: hi edson, imo the whole handling of the multi-key criteria is a little bit weird. what should the sql look like in your case ? jakob Edson Carlos Ericksson Richter wrote: Hum... There is some instability here. I don't know what combination of dynamic proxies/collection proxies is causing this bug. I've fixed using either proxy=true in the collections inside each bean... Why? I really don't know. I'll need to compare each of the 12 collections involved in this beans to know what's give the stack trace... I'll need sometime to restart the app 132 times to know :( Anyway, if someone could send me the rc5 implementation of the method, so I can compare with actual, I'll appreciate. Thanks in advantage. Edson Richter - Original Message - From: Edson Carlos Ericksson Richter To: 'OJB Users List' Sent: Wednesday, March 24, 2004 2:46 PM Subject: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPre fetcher.java:338) This bug is driving me crazy... Someone could point me what changed from rc5 to 1.0 in this method (so I can at least fix locally)? The problem is a M:N mapping using composite pk pointing the M bean, and 1 field pk pointing to the N bean. The stack trace is: java.lang.ArrayIndexOutOfBoundsException: 1 at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit eriaMultipleKeys(MtoNCollectionPrefetcher.java:338) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit eria(MtoNCollectionPrefetcher.java:259) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer y(MtoNCollectionPrefetcher.java:115) at org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries( CollectionPrefetcher.java:93) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations hip(MtoNCollectionPrefetcher.java:68) at org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR eferenceBroker.java:277) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe ferenceBroker.java:146) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe ferenceBroker.java:203) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis tenceBrokerImpl.java:1046) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( DelegatingPersistenceBroker.java:321) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( DelegatingPersistenceBroker.java:321) at org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j ava:109) at org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148) at org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja va:362) at org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140) at org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71) at br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6 3) at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1 098) at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281) at javax.swing.JComponent.getPreferredSize(JComponent.java:1275) at javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913) at javax.swing.ViewportLayout.preferredLayoutSize(
Re: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPrefetcher.java:338)
The expected result is something like A<->B<->C Where A is M side has PK with 2 fields, C is N side has PK with 3 fields, B is indirection table, and has 5 fields. select * from A join B on A.field1 = B.field1 and A.field2 = B.field2 join C on C.field1 = B.field3 and C.field2 = B.field4 and C.field3 = B.field5 I expect this help. Edson Richter Jakob Braeuchi wrote: hi edson, imo the whole handling of the multi-key criteria is a little bit weird. what should the sql look like in your case ? jakob Edson Carlos Ericksson Richter wrote: Hum... There is some instability here. I don't know what combination of dynamic proxies/collection proxies is causing this bug. I've fixed using either proxy=true in the collections inside each bean... Why? I really don't know. I'll need to compare each of the 12 collections involved in this beans to know what's give the stack trace... I'll need sometime to restart the app 132 times to know :( Anyway, if someone could send me the rc5 implementation of the method, so I can compare with actual, I'll appreciate. Thanks in advantage. Edson Richter - Original Message - From: Edson Carlos Ericksson Richter To: 'OJB Users List' Sent: Wednesday, March 24, 2004 2:46 PM Subject: MtoNCollectionPrefetcher.buildPrefetchCriteriaMultipleKeys(MtoNCollectionPre fetcher.java:338) This bug is driving me crazy... Someone could point me what changed from rc5 to 1.0 in this method (so I can at least fix locally)? The problem is a M:N mapping using composite pk pointing the M bean, and 1 field pk pointing to the N bean. The stack trace is: java.lang.ArrayIndexOutOfBoundsException: 1 at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit eriaMultipleKeys(MtoNCollectionPrefetcher.java:338) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchCrit eria(MtoNCollectionPrefetcher.java:259) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.buildPrefetchQuer y(MtoNCollectionPrefetcher.java:115) at org.apache.ojb.broker.accesslayer.CollectionPrefetcher.buildPrefetchQueries( CollectionPrefetcher.java:93) at org.apache.ojb.broker.accesslayer.MtoNCollectionPrefetcher.prefetchRelations hip(MtoNCollectionPrefetcher.java:68) at org.apache.ojb.broker.core.QueryReferenceBroker.performRetrievalTasks(QueryR eferenceBroker.java:277) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe ferenceBroker.java:146) at org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(QueryRe ferenceBroker.java:203) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Persis tenceBrokerImpl.java:1046) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( DelegatingPersistenceBroker.java:321) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( DelegatingPersistenceBroker.java:321) at org.apache.ojb.broker.accesslayer.CollectionProxy.loadData(CollectionProxy.j ava:109) at org.apache.ojb.broker.accesslayer.ListProxy.loadData(ListProxy.java:148) at org.apache.ojb.broker.accesslayer.CollectionProxy.getData(CollectionProxy.ja va:362) at org.apache.ojb.broker.accesslayer.ListProxy.getListData(ListProxy.java:140) at org.apache.ojb.broker.accesslayer.ListProxy.get(ListProxy.java:71) at br.com.mgr.dialogs.ListBasedListModel.getElementAt(ListBasedListModel.java:6 3) at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1 098) at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:281) at javax.swing.JComponent.getPreferredSize(JComponent.java:1275) at javax.swing.JList.getPreferredScrollableViewportSize(JList.java:1913) at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:72) at java.awt.Container.preferredSize(Container.java:1178) at java.awt.Container.getPreferredSize(Container.java:1162) at javax.swing.JComponent.getPreferredSize(JComponent.java:1277) at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:475) at java.awt.Container.preferredSize(Container.java:1178) at java.awt.Container.getPreferredSize(Container.java:1162) at javax.swing.JComponent.getPreferredSize(JComponent.java:1277) at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:572) at java.awt.Container.preferredSize(Container.java:1178) at java.awt.Container.getPreferredSize(Container.java:1162) at javax.swing.JComponent.getPreferredSize(JComponent.java:1277) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout
Re: Mapping two classes two one table
The result of a report query is a Object [], where each element represents a row from the database, and is a Object[] (one value for each field returned). Best regards, Edson Richter Guido Beutler wrote: Hi jakob, Thanks for the fast reply! works fine but one shot question: How do I get the values (colums) from the object ? At the test cases I found only asserts on the size of the collection. Of course I would like to get the values. Thanks in Advance!! best regards, Guido Jakob Braeuchi wrote: hi guido, use a report-query to retrieve the pks only. hth jakob Guido Beutler wrote: Hi, I've got a small problem. I have a table with many columns. I would like to select only the primary key field with a complex select first. It's like a candidate list. From that I can find the correct value (independen from the database). For the correct value I would like to receive all data. I build two classes and mapped them to the same table. This is working fine. I got one class only with the primary key and another with all fields. I do not use inheritance, because all entries of the table have the same type (there is no third class with another type). The problem now is , that during the select for the primary key class OJB creates a select for all colums although only the primary key is needed. This is working, the primary key class is filled correctly. The the reason for building a primary key class was the performance impact of reading all coloumns. I would like to avoid reading all colums if I need only one. Is there a way to avoid reading all coulums directly? best regards, Guido - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reference (1:1) and null
Hi! When retrieving a 1:1..0 mapping using proxies, after counting how many values has in the table, OJB should set the referenced object to NULL when counting is 0 (not setting the reference for a proxy that will give a NPE when trying to call a method). If the value set is a proxy (event if will never have a value there, since count is 0) the following statement always goes to else section, and gives a NPE: // The following test is always false, because until now, myReferencedObject is a reference to a proxy. // But the select count(*) returned 0. if( myObject.myReferencedObject==null ) { System.out.println("There is no reference"); } else { System.out.println("There is reference!"); System.out.println("myObject.myReferencedObject.getId() = " + myObject.myReferencedObject.getId()); // the previous line will throw a NPE, because when materializing, it return NULL!!! } Is possible to fix this? There is one workaround, map all 1:0..1 mappings as collections and does internal treatment to them, or not use Proxy for 1:0..1 mappings (that will set value to NULL when there is no referenced object - as expected). Thanks, Edson Richter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.0 RemovalAware doesnt work (was 1.0 - one more bug)
Appear that this code is missed from 1.0 CVS HEAD: // invoke callback on collection if (col instanceof ManageableCollection) { ((ManageableCollection) col).afterStore(this); } in PersistenceBrokerImpl, method storeCollections. Edson Carlos Ericksson Richter wrote: I tracked down to the call to fireBrokerEvent just after calling store(myObject). When the call to afterStore in my RemovalAwareList should be called? Thanks Edson Richter Edson Carlos Ericksson Richter wrote: Someone know what happened to the afterstore methods??? Thaks, Edson Richter Edson Carlos Ericksson Richter wrote: Ops, the correct is "The afterstore method is NOT being called". Tkx, Edson Richter - Original Message ----- From: "Edson Carlos Ericksson Richter" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, March 24, 2004 4:25 PM Subject: 1.0 - one more bug The afterstore method is being called. This is very embaracing since we need this for the RemovalAwareCollection (and RemovalAwareList). This is a known bug, is there a workaround? Thanks in advantage, Edson Richter --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 1.0 RemovalAware doesnt work (was 1.0 - one more bug)
I tracked down to the call to fireBrokerEvent just after calling store(myObject). When the call to afterStore in my RemovalAwareList should be called? Thanks Edson Richter Edson Carlos Ericksson Richter wrote: Someone know what happened to the afterstore methods??? Thaks, Edson Richter Edson Carlos Ericksson Richter wrote: Ops, the correct is "The afterstore method is NOT being called". Tkx, Edson Richter - Original Message ----- From: "Edson Carlos Ericksson Richter" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, March 24, 2004 4:25 PM Subject: 1.0 - one more bug The afterstore method is being called. This is very embaracing since we need this for the RemovalAwareCollection (and RemovalAwareList). This is a known bug, is there a workaround? Thanks in advantage, Edson Richter --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.637 / Virus Database: 408 - Release Date: 20/3/2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]