Reminds me of something I've been wondering about for a little while
now.  I have a partial-false finder method which does a join:
 
select Response.question, Response.member, Response.self,
Response.wanted, Response.weight from Response, Category_questions where
Response.member = $1 and Category_questions.name = $2 and
Response.question = Category_questions.value
 
Sometimes (not every time) after touching my ejb-jar.xml, Orion decides
to change the order of the fields "question" and "member", which are CMR
fields and a compound PK.  The consqequence is that any calls to the
finder method result in an "incorrect data type" exception from the jdbc
driver.  I would hate to imagine what the error would have been if the
fields had both been the same type...
 
Easy enough to fix (go into orion-ejb-jar.xml and change the select
order), but annoying nevertheless.
 
Has anyone else experienced anything like this?  Since the problem shows
up intermittently, hunting it down is a real pain.  I don't know if it's
a bug with partial-false, CMR fields as keys, compound keys, or only
when all three are put together :-)
 
Jeff Schnitzer
[EMAIL PROTECTED]

-----Original Message-----
From: Boris Gertsberg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 21, 2000 10:10 AM
To: Orion-Interest
Subject: Re: CMP-findBy method


Your select statement in findBy method MUST include EVERY mapped
property of your Entity Bean even if you use partial SQL statement.
(i.e:"select T_Hotel.hotel_name,T_Hotel.trans_xid from T_Hotel where
T_Hotel.trans_xid=$1")
After findBy method found each of your entity beans application server
loads the data into memory. That's why it MUST have EVERY field.
Otherwise it would have to do n+1 SQL query to load your bean. 1 select
statement is faster then n+1.
 
Actually you probably don't even need to use partial="false" here. The
only good use for partial that I found is calling stored procedures and
doing complex joins in findBy methods.

Boris



----- Original Message ----- 
From: tasneem <mailto:[EMAIL PROTECTED]>  
To: Orion-Interest <mailto:[EMAIL PROTECTED]>  
Sent: Thursday, December 21, 2000 9:54 AM
Subject: CMP-findBy method

Hello everybody
 
I have a problem i hav a CMP bean in which i am doing doing a findBy
method to get some info from my table.
As per the normal way i have mentioned the query in my home class.
After deploying have also found the same query in the orion.ejb.jar xml
file but when i run my application the look up gets done
findByPrimaryKey method is also working but the moment it reaches this
findBy method it gives me the following error.
 
Note: My query looks like this in orion.ejb.jar xml file :
<finder-method query="select T_Hotel.hotel_name from T_Hotel where
T_Hotel.trans_xid=$1" partial="false">
    <!-- Generated SQL: "select T_Hotel.hotel_name from T_Hotel where
T_Hotel.trans_xid=?" -->
where hotel_name , trans_xid are my columns and the table name is
T_Hotel
 
 
java.sql.SQLException: Column not found
 at sun.jdbc.odbc.JdbcOdbcResultSet.findColumn(Unknown Source)
 at sun.jdbc.odbc.JdbcOdbcResultSet.getInt(Unknown Source)
 at
THotelHome_EntityHomeWrapper2.findByTrans_xid(THotelHome_EntityHomeWrapp
er2.java:959)
 at CMP.HotelServlet.doGet(HotelServlet.java:61)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at com.evermind.server.http.d1.si(JAX)
 at com.evermind.server.http.d1.forward(JAX)
 at com.evermind.server.http.ed.sp(JAX)
 at com.evermind.server.http.ed.so(JAX)
 at com.evermind.util.f.run(JAX)



Reply via email to