Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Is updating data allowed using ejbPostCreate()

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().
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.
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.
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.
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic