Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is updating data allowed using ejbPostCreate()

 
Sudeep das
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kathy,
My name is Sudeep and I know you first by your Head First approach with EJB.
First of all Wish u a Very Happy NEW YEAR 2004.
I have got stuck with a very simple problem... pls help me out.
I am using Weblogic 7.0 with Oracle 9i. Trying to insert a row of data which has two values an "integer" and another "clob". There is an issue with Weblogic handling "Clob" using CMPs.
A data in clob can be easily inserted using BMP beans using PreaparedStatement.
As CMP's don't allow me to add data into database from ejbCreate() using SQL statements. I am trying to write the statements inside the ejbPostCreate().
Now my question is. As we already know that ejbPostCreate() runs under the same transaction as ejbCreate(). Will be it valid to enter data using SQL Statements ejbPostCreate().
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Sudeep,
It is a simple but a nasty problem. As you point out above, the CMP doesn't work with the CLOBs. Therefore, you are forced to use BMP to work with the CLOB data. As best as I can remember, I had to issue a Commit statement to get the Oracle 9i drivers to store the CLOB data, this is a limitation of the WebLogic7.0/Oracle9i/drivers combination. Therefore, you have to use BMP if you are using this set of tools and also using CLOBs. What you can do is to issue an UPDATE statement in ejbPostCreate following the ejbCreate since the primaryKey has been established by the time you get into ejbPostCreate method. Very ugly, but works.
Regards.
Bharat
p.s. These are the kind of things that you run into in real life where Specs don't help much. I wish that the vendors and Sun were better at dealing with them.
 
Nick Bauman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been reading that Hibernate can be used as a BMP solution.
What I don't understand is that CLOBs are supposed to be supported in the JDBC spec for quite some time as a standard type (like, I think, as a String). I remember when PostgreSQL had trouble with JDBC standard large object support until they finally incorporated their large object support in their JDBC 2.0 driver over a year ago. So why wouldn't this work with Oracle today?
Just my thinking.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic