If you were writing the SQL yourself, you would have to pad string constants
yourself when testing for equality against a char field. I'd recommend
switching to varchar2(10) instead. varchar2 isn't blank-padded.

Kurt in Atlanta

>-----Original Message-----
>From: John Pletka [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, November 08, 2000 7:16 PM
>To: Orion-Interest
>Subject: findByPrimaryKey problem, Oracle char(10) space padding
>
>
>I'm having a problem with Orion's findByPrimaryKey() method 
>when the column
>type is CHAR(10).  The problem is Oracle pads out the column 
>to fill in the
>extra spaces.  For example, if you store "KEY" in a CHAR(10) 
>field, Oracle
>saves it at "KEY       ".  This does not affect any queries 
>run directly
>through JDBC or SQL-Plus (you can write "WHERE key = 'KEY' " without
>worrying about the spaces).  Orion seems to have problems with 
>it though.
>What I've found is Orion will only locate a record if I 
>manually pad out the
>string when I'm creating my PK class. 
>       What exactly does Orion do for these finder methods?  
>If it ran the
>query against the database, it should (theoretically) be 
>handled by Oracle.
>Is there any way to see the SQL Orion sends to the database?  
>I don't think
>it loads the table into memory beforehand, but is there some 
>manipulation I
>can do to the EJB.java file (maybe in the ejbPostCreate()) to trim the
>values.  I guess I don't totally understand how Orion compares the
>PrimaryKey class to the records in the database.
>
>                       Thanks in advance
>                               John
>

Reply via email to