Hi Aaron.

As you suggested, I have tested 3 different situations in which the member
variable in the entity bean class is java.lang.String, when the only thing I
change is jaws.xml :

1. no <jdbc-type> in jaws.xml :
create works fine !!! it inserts the data to the db
findByPrimaryKey (so I can getXXX() that value) causes a STRANGE thing ! it
finds the entity but getXXX() returns NULL. I check the db, and it seems
that invoking the find method sets the column value in the db to NULL
(!?!?!?)
(off-course i re-started jBoss after the create so it will go to the db and
wont get the data from cache)

2. <jdbc-type>VARCHAR</jdbc-type>:
same as above. create works fine but findByPrimaryKey causes the column to
become null.

3. <jdbc-type>CLOB</jdbc-type>
create throws the following exception:

[JAWS] java.lang.ClassCastException: java.lang.String
[JAWS]  at
oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement
.java:2073)
[JAWS]  at
oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement
.java:2109)
[JAWS]  at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setParameter(JDBCCommand.java:31
1)
[JAWS]  at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.setParameters(JDBCCr
eateEntityCommand.java:165)
[JAWS]  at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:154
)
[JAWS]  at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEn
tityCommand.java:135)
[JAWS]  at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersisten
ceManager.java:122)
[JAWS]  at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManag
er.java:156)
[JAWS]  at
org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:427)
[JAWS]  at java.lang.reflect.Method.invoke(Native Method)
[JAWS]  at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContaine
r.java:585)
[JAWS]  at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySync
hronizationInterceptor.java:156)
[JAWS]  at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInt
erceptor.java:86)
[JAWS]  at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
[JAWS]  at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
java:263)
[JAWS]  at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
[JAWS]  at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
a:126)
[JAWS]  at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
[JAWS]  at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:309)
[JAWS]  at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
nerInvoker.java:207)
[JAWS]  at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
nerInvoker.java:153)
[JAWS]  at java.lang.reflect.Method.invoke(Native Method)
[JAWS]  at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
[JAWS]  at sun.rmi.transport.Transport$1.run(Unknown Source)
[JAWS]  at java.security.AccessController.doPrivileged(Native Method)
[JAWS]  at sun.rmi.transport.Transport.serviceCall(Unknown Source)
[JAWS]  at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
[JAWS]  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
Source)
[JAWS]  at java.lang.Thread.run(Unknown Source)


I must point that I am using jBoss 2.0 BETA-PROD-03 and didnt get any new
code from the CVS (I still dont know how...)
Another important thing : I use oci driver (I guess results with thin driver
would be worse...)
Should I perfrom the same test with the change you have made in the CVS (the
problem indeed seems to be reading the CLOB )?
any other idea ?

Thanks ahead,
Shahar

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Mulder
Sent: Monday, November 06, 2000 7:07 PM
To: jBoss
Subject: Re: [jBoss-User] CLOB field in CMP entity


        We had never tried CLOBs before.  I just checked a change in to
CVS that should enable you to read a CLOB if you're looking for a
String.  So make the variable a String, and see if JAWS can read
it.  You may want to try once without any specific entry in jaws.xml for
the field (it should be declared in ejb-jar.xml, of course), and if that
doesn't work, add a cmp-field entry with the sql-type CLOB and the
jdbc-type VARCHAR, and if that doesn't work try the jdbc-type CLOB.
        There may still be writing problems, but we'll take this one step
at a time.  If you do have further problems, please send a complete stack
trace as that will be much easier to work with.  Also, you could just send
me your bean class if you like, which would eliminate some of the
turnaround... :)

Aaron

On Mon, 6 Nov 2000, Shahar wrote:
> Hi jBoss users !
>
> My problem is as follows :
>
> I have an Oracle 8.1.6 table :
>
> (myID         NUMBER,
> myName        VARCHAR2(100),
> myOpinion     CLOB)
>
> I want to represent a row in this table as an entity-bean.
> I want to make it a CMP entity-bean.
>
> I would like to refer to myOpinion filed as a java.lang.String.
> i.e. ,I would like to be able to code this in the remote interface:
>
> public void setMyOpinion(java.langString myOpinion) throws
RemoteException;
> public java.lang.String getMyOpinion() throws RemoteException;
>
> I would also like the create method to have the following signature:
> (int myID,String myName,String myOpinion)
>
> Can I have jBoss manage the CLOB field persistance ?
> Can I declare the field as java.lang.String ?
> How should my jaws.xml look like for this field ?
> Should I map java.lang.String to jdbc-type CLOB ? or do something else ?
> I have tried many combinations of type declaring, mapping and coding, but
> each failed.
> Should I assume jBoss doesnt support CLOB CMP-fileds ???
>
> Please help, Shahar.
>
>
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]
>



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to