Hi Shiva,
lets assume you have a class AZ with properties A, B, C, .... until Z
and you have a mapping for this class to table AZ. Then you can also
create a class ABC with properties A, B, C only and map this also to
table AZ. But there are some limitations if you use that:
1. queries on ABC can only use the properties of ABC so it is not
possible to add a condition for Z.
2. you have to take care not to be hit by ObjectModifiedExceptions which
happen if a cached object differ from its representaion in the database.
Think of the following situation:
- You load an object with identity 1 as AZ with A='foo' which causes
this object to be cached.
- Then you load the same object with identity 1 as ABC and set A='bar'
this also causes this object to be cached but with A='bar'. The column
for A in the database now also contains 'bar'.
- If you now call db.load(AZ.class, new Integer(1) you will get the
cached object with A='foo' which is wrong.
- and if you try to set A='foobar' on that AZ instance and try to
persist it you will get that ObjectModifiedException.
A way to prevent this is to only cache AZ instances and only change AZ
instance while ABC instances are not cached and never changed.
According to this problems I would not suggest you to use this
workaround until you really know what you are doing.
If you search for some performance tips you would propably want to have
a look at:
http://castor.codehaus.org/jdo-best-practice.html
I also suggest you to study our performance test suite PTF as this also
contains some tricks that could increase load performance dramatically
by optimizing usage of cache. Especially have a look at the tests that
execute pass through queries that only return object identities which
are the then used to db.load() the objects from cache if present there.
Depending on your class hierarchy you can see load time reduced by a
factor of 10.
Regards
Ralf
Shiva P. Kodityala schrieb:
Thank you, Ralf.
In this case, I may do it. No issue. The problem is when you have so many
fields in a table and you just want a few of them. Is there any other way to do
it? Or shall I use plain jdbc? Performance is important when you are dealing
with huge number of rows.
-----Original Message-----
From: Ralf Joachim [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 16, 2005 1:31 PM
To: [email protected]
Subject: Re: [castor-user] Select Query
Hi Shiva,
why not only returning 'p' which holds the properties 'a', 'b' and 'd'.
Your OQL for this should be:
SELECT p FROM com.scif.test.Table1 p WHERE p.a=$1
Having said that castor's OQL not supports to return multiple values at
the moment.
Regards
Ralf
Shiva P. Kodityala schrieb:
"SELECT p.a , p.b , p.d FROM com.scif.test.Table1 p WHERE a=$1"
Is there anything wrong with the query?
Getting error:
org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type was found
near , (found COMMA, but expected KEYWORD_FROM)
Can I not select more than one value? Is there any other way to doit?
Thanks
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------