• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to manage CMP field with Boolean type????

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am developing EJB application with CMP2.X specification. I have 2 fields with boolean datatype in my database. When I am trying to put getter n setter for those beans as follows:-
============
public Boolean getQuoted() {
return quoted;
}

public void setQuoted(Boolean quoted) {
this.quoted = quoted;
}

==============

& when i m deploying bean on server n when i m executing client on bean i m getting error like:-
==========
Cannot create CDBean: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: Internal error setting parameters for field quoted; CausedByException is:
Unknown Types value.
==========

& when i m removing those fields in my EJB with boolean type, It works fine n record gets inserted in DB.

Please tell me how to manage fields with boolean type.

Thanx,

Prash
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I remember vaguely hitting something like this once before in a CMP layer. I'd suggest experimenting with the column definition in the table, try different types. I think the problem had something to do with default type conversion issues between JDBC and SQL and null versus "false". I suspect you wouldn't see the problem at all if the type was "boolean" instead of "Boolean", but if you need the third state then you may need to experiment to find the SQL type for your particular database vendor/JDBC driver that will cause true/false/null to get handled correctly.
 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please tell me how to deal with field in my Database table with boolean type. I am using postgresql8.0 as Database. & I have coulmn in my table for which I want to set & get values as "true"/"false".
But when i m writing for getters n setters for this boolean field in My CMP EJB class as follows:-
=============================
/**
* @ejb.interface-method view-type = "both"
* @ejb.persistence column-name = "quoted"
* jdbc-type = "BOOLEAN"
* sql-type = "boolean"
* @return Returns the quoted.
*/
public boolean getQuoted() {
return quoted;
}

/**
* @ejb.interface-method view-type = "both"
* @param quoted The quoted to set.
*/
public void setQuoted(boolean quoted) {
this.quoted = quoted;
}

===============================

After Deploying this bean when I m trying to run client on it, it gives me error like:-
==================================

java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:217)...............
....................
==================================

Please tell me how should I manage this boolean field???

Also When I m trying to deploy bean without boolean field included in it, It works fine with data gets inserted into database. But Problem comes after boolean field included into Bean.

Please help me. I am trying to solve this since last three days.

Thanx in advance .
Prash
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having the same problem with JBoss 4.02. I have tried an accessor of isQuoted() (as the Java Beans spec notes) and getQuouted() as suggested by http://www.coredevelopers.net/library/jboss/cmp/cmp-field.jsp

EJB Doclet doesn't seem to be playing nice right now either.
reply
    Bookmark Topic Watch Topic
  • New Topic