You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Tino Schöllhorn <t....@tiscali.de> on 2004/02/13 18:33:44 UTC
Cache issue
Hi,
I have (again) something weird which I suppose is just a configuration
problem:
I have a class Person which has one LONGVARCHAR-Field. The first time
the object is accessed the LONGVARCHAR-field is returned correctly. But
the second time it is accessed it returns just 256 (I suppose) characters.
I am using Access as 'database' but I don't think this is the problem.
Do you have any ideas what I could try?
Tino
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache issue
Posted by Tino Schöllhorn <t....@tiscali.de>.
Hello Armin,
the data is correct in the database. But I now made another observation:
If the data is retrieved by:
Query query = new QueryByCriteria(Person.class, null);
return pb.getCollectionByQuery(query);
the resulting collection is correctly instantiated.
But if I use
Criteria crit = new Criteria();
crit.addEqualTo("id", myId);
Query query = QueryFactory.newQuery(Person.class, crit, true);
res = pb.getObjectByQuery(query);
I get the truncated data. So my first description wasn't quite correct -
but something is very strange - in my opinion.
regards
tino
Armin Waibel wrote:
> Hi,
>
> Tino Schöllhorn wrote:
>
>> Hi,
>>
>> I have (again) something weird which I suppose is just a configuration
>> problem:
>>
>> I have a class Person which has one LONGVARCHAR-Field. The first time
>> the object is accessed the LONGVARCHAR-field is returned correctly.
>
>
> hmm, does this mean first time after creation? Which cache was used?
> Maybe first time after store it was found in cache, second time it was
> read from DB. So I assume your "database" truncate the String on insert.
> Maybe I'm wrong ;-)
>
> regards,
> Armin
>
>> But the second time it is accessed it returns just 256 (I suppose)
>> characters.
>>
>> I am using Access as 'database' but I don't think this is the problem.
>>
>> Do you have any ideas what I could try?
>> Tino
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache issue
Posted by Armin Waibel <ar...@apache.org>.
Hi Tino,
I don't think that OJB is the problem (but maybe I'm wrong). The only
difference between the Criteria is the 'distinct' flag. So I this Access
has a problem with the distinct flag. Please enable p6spy to trace the
generated SQL statements.
See
http://db.apache.org/ojb/faq.html#How can I trace and/or profile SQL
statements executed by OJB?
How does the generated SQL for both Criteria look like?
Try to invoke these statements against your DB and compare the results.
If both statements return the same result ... OJB has a problem ;-)
regards,
Armin
Tino Schöllhorn wrote:
> Hello Armin,
>
> I could pinpoint the described error. It all boils to the
> QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the
> code to retrieve an instance of class Person with:
>
> Criteria crit = new Criteria();
> crit.addEqualTo("id", "85");
> Query query = QueryFactory.newQuery(Person.class, crit);
>
> Collection c = pb.getCollectionByQuery(query);
> .... and so on
>
> everything works perfectly and the instances of Person are instantiated
> correctly. But if I use the method described in the first place:
>
> Criteria crit = new Criteria();
> crit.addEqualTo("id", "85");
> Query query = QueryFactory.newQuery(Person.class, crit, true);
>
> After that query the LONGVARCHARS aren't correctly instantiated.
>
> I think that this might be an error of OJB.
>
> With regards
> Tino
>
>
>
>
>
> Armin Waibel wrote:
>
>> Hi,
>>
>> Tino Schöllhorn wrote:
>>
>>> Hi,
>>>
>>> I have (again) something weird which I suppose is just a
>>> configuration problem:
>>>
>>> I have a class Person which has one LONGVARCHAR-Field. The first time
>>> the object is accessed the LONGVARCHAR-field is returned correctly.
>>
>>
>>
>> hmm, does this mean first time after creation? Which cache was used?
>> Maybe first time after store it was found in cache, second time it was
>> read from DB. So I assume your "database" truncate the String on insert.
>> Maybe I'm wrong ;-)
>>
>> regards,
>> Armin
>>
>>> But the second time it is accessed it returns just 256 (I suppose)
>>> characters.
>>>
>>> I am using Access as 'database' but I don't think this is the problem.
>>>
>>> Do you have any ideas what I could try?
>>> Tino
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache issue
Posted by Tino Schöllhorn <t....@tiscali.de>.
Hello Armin,
I could pinpoint the described error. It all boils to the
QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the
code to retrieve an instance of class Person with:
Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit);
Collection c = pb.getCollectionByQuery(query);
.... and so on
everything works perfectly and the instances of Person are instantiated
correctly. But if I use the method described in the first place:
Criteria crit = new Criteria();
crit.addEqualTo("id", "85");
Query query = QueryFactory.newQuery(Person.class, crit, true);
After that query the LONGVARCHARS aren't correctly instantiated.
I think that this might be an error of OJB.
With regards
Tino
Armin Waibel wrote:
> Hi,
>
> Tino Schöllhorn wrote:
>
>> Hi,
>>
>> I have (again) something weird which I suppose is just a configuration
>> problem:
>>
>> I have a class Person which has one LONGVARCHAR-Field. The first time
>> the object is accessed the LONGVARCHAR-field is returned correctly.
>
>
> hmm, does this mean first time after creation? Which cache was used?
> Maybe first time after store it was found in cache, second time it was
> read from DB. So I assume your "database" truncate the String on insert.
> Maybe I'm wrong ;-)
>
> regards,
> Armin
>
>> But the second time it is accessed it returns just 256 (I suppose)
>> characters.
>>
>> I am using Access as 'database' but I don't think this is the problem.
>>
>> Do you have any ideas what I could try?
>> Tino
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache issue
Posted by Armin Waibel <ar...@apache.org>.
Hi,
Tino Schöllhorn wrote:
> Hi,
>
> I have (again) something weird which I suppose is just a configuration
> problem:
>
> I have a class Person which has one LONGVARCHAR-Field. The first time
> the object is accessed the LONGVARCHAR-field is returned correctly.
hmm, does this mean first time after creation? Which cache was used?
Maybe first time after store it was found in cache, second time it was
read from DB. So I assume your "database" truncate the String on insert.
Maybe I'm wrong ;-)
regards,
Armin
> But
> the second time it is accessed it returns just 256 (I suppose) characters.
>
> I am using Access as 'database' but I don't think this is the problem.
>
> Do you have any ideas what I could try?
> Tino
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org