Hello Armin,
The situation looks like this: - each work will be tracked by a job-object - 1st run, insert address objects, and others witch are related - each addressobject contains a unique emailaddress (per job) - 2nd run, insert of 1st emailaddress (create adressobject) works - for each mailaddress i check, if there is allready an object, which has the same emailaddress - the funny thing is, that the method findMailaddress() does not find a previous inserted object. The result is, that in rare situations, i've got objects with the same emailaddresses.
Could this be a concurrency problem? Each PB instance use it's own DB connection, so could it be the case that the created email was not committed before another thread or PB instance call findMailaddress()?
I've allready implemented a simple count-method, this method just counts the
number of addressobject with a specific emailaddress/job. This method shows
allways the same result.
I've checked the DB-DEBUG-LOG: the UPDATE/INSERT statements in the logfile, looks fine. Thats why i am thinking, that there is a problem in the cache, or the configuration itself.
This couldn't be a cache problem, because you are using ObjectCacheEmptyImpl in the jdbc-connection-descriptor. So OJB doesn't cache any objects (only on materialization of object OJB use a temp buffer to avoid endless loops on circular references).
The funny thing is, that in a new 'cache'-situation (for example after a restart), everything works fine.
And it never happen again? Or does it happen again on next creation of an Emailaddress?
regards, Armin
Hope, that it gives some more background.
Regards, Phil
Hi Phil,
could you describe more detailed what's going wrong? Do you get a wrong Mailaddress object where specified "emailAddress" and "jodId" doesn't match or get you an "empty" Mailaddress object or 'null'?
Did you check the generated SQL via P6Spy or via DB log?
regards, Armin
Philipp Gasser wrote:
Hello everybody,
i've got a very strange situation, and i hope, that anybody can give me
an
idea how to fix the problem.
I use: ojb 1.0.3 release db mysql (all type innodb), rel 4.1.11
I have a query situation, which works the first time. But in some cases,
it
doesn't work -> the result is not valid! The query evaluates, if a specific mailaddress exists or not.
I guess, that it is a cache-problem: I use '<object-cache class="org.apache.ojb.broker.cache.ObjectCacheEmptyImpl"/>'.
code snip: public Mailaddress findMailaddress( final Job job, final String mailaddress ) { Mailaddress aMailaddress = null; final Criteria mailAdressCriteria = new Criteria( ); final Criteria mailAdressAndCriteria = new Criteria( ); mailAdressCriteria.addEqualTo( "emailAddress", mailaddress
);
mailAdressAndCriteria.addEqualTo( "jobId", job.getId( ) ); mailAdressCriteria.addAndCriteria( mailAdressAndCriteria );
final QueryByCriteria mailAdressQuery = new QueryByCriteria( Mailaddress.class,
mailAdressCriteria
); aMailaddress = (Mailaddress)m_broker.getObjectByQuery( mailAdressQuery );
return aMailaddress; } catch( final Throwable t )
I really hope, that anybody can help me.
Thanks in advance Phil
--------------------------------------------------------------------- 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]
