Hi Roman,
An crit.addEqualTo( "state", "somestate" ) will generate SQL as state =
'somestate'
crit.addLike( "state", "somestate" ) will generate SQL as state LIKE 'somestate'
Like is used for pattern matching, equal for exact matches, so in this case the
equal may have been ok.
Crit.addColumnEqualTo("state", "somestate" ) does not translation of the attribute name,
if for example in your repository.xml you have defined an attribute "state" mapped to
column STATE_NAME, in this case the first two variants will work since they
will generate the correct SQL code (STATE_NAME = 'somestate' or STATE_NAME LIKE
'somestate') the last
variant will not work because it adds an untranslated name and would generate
SQL that will not be accepted for your db-schema. (state = 'somestate')
bye
danilo
I am still new to OJB and I was just wondering why in the suggestion
code below you chose
crit.addLike( "state", "somestate" );
Rather than something like
Crit.addEqualTo("state", "somestate");
Or even
Crit.addColumnEqualTo("state", "somestate");
Sorry if this is a stupid question, but I just was wondering why?
Roman
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]