Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes CMP EJB Getters/Setters already defined error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMP EJB Getters/Setters already defined error" Watch "CMP EJB Getters/Setters already defined error" New topic

CMP EJB Getters/Setters already defined error

Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
Hello. If somebody has a minute, I am really frustrated on this one. What I am close to setting up here is a stateless session wrapping two entities...the first entity obtains/creates two derives a sequential tracking number from the database and creates a unique primary key. The second entity does an insert based on 65 or so other fields that are passed to it along with the new tracking number and the primary key. The trigger for the stateless session ejb will be a submit from a frontend form.

The first entity that obtains the control number works fine wrapped in the session. Now when I go to compile the session with ~both~ entities, I get an error on the getter/setter method for ~most~ of the database fields in the insert entity. But not all of the fields...the control number that I derived via the first entity is fine, as well as the unid field, which is derived from the UUID class in the first entity and serves as the primary key. However, the error occurs on the fields that are passed via the form submit and subsequently through parameter method calls. Here is a chopped down version of the insert entity bean...the unid and control number are generated via the first entity and the c_subject field is passed from the form. I get the getter/setter already defined error in this bean class on the c_subject field. As a test, I compiled this class as a stand-alone and it compiles fine. Any help is greatly appreciated...thank you so much for reading this.

import java.util.Collection;
import javax.ejb.*;


import java.util.*;

import javax.naming.*;

public abstract class CnInsertBean implements EntityBean
abstract public String getUnid();
public abstract void setUnid( String value );

abstract public String getControl_no();
public abstract void setControl_no( String value );

abstract public String getC_subject();
public abstract void setC_subject( String value );

public EntityContext ctx;

public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
public void unsetEntityContext() {
this.ctx = null;

public String ejbCreate()
throws CreateException {
return null;
public String ejbCreate(String unid,
String control_no,
String c_subject) throws CreateException {

setUnid( unid );
setControl_no( control_no );
setC_subject( c_subject );

return unid;}

public void ejbPostCreate(String unid,
String control_no,
String c_subject) {
public CnInsertBean() {}

public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbLoad() {}
public void ejbStore() {}
public void ejbRemove() throws RemoveException {}
[ April 07, 2005: Message edited by: Tom Griffith ]
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
just a little more information or whatever...this is the entity in my ejb descriptor...








Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
ok...this is really bizarre. I have been slipping different CMP fields in for the third getter/setter (the c_subject column insert in the code above). I get this "Already defined" error on the getter/setter whenever the column name incorporates one letter followed an my case, I have three fields...


All other field names I toss in there, so far, have no problems. I'm going to keep messing wiht this.
Tom Griffith
Ranch Hand

Joined: Aug 06, 2004
Posts: 257
yep, I have one other field with the one letter followed by an underscore format...


and it gives me the error. I have another field, ad_instr, which compiles fine. I've tested about 40 fields and all compile except for these four with the single letter and underscore. I'm convinced this has to be something with how this ejb compiler parses values (resin 3.0.11). I think I will e-mail caucho or whatever with this...but it's here if somebody else comes across this quirk.

I'm not sure what to do here...if I change the column names on these four, then I have to drop the table, redo the data migration, then change all the setters/getters and fields in all the beans and jsps (not to mention the javascript routines). Heavy burden. I guess I'll have to do jdbc for the insert part...but I really wanted to do this via entity since I already have CMP. Anyone know of a way to mask the true column name in CMP and map to it from a phony?
[ April 07, 2005: Message edited by: Tom Griffith ]
Don't get me started about those stupid light bulbs.
subject: CMP EJB Getters/Setters already defined error
Similar Threads
ejbCreate, primary keys and deployment descriptors question
problem with entity beans remote interface and bean class
Urgent J2EE deploytool help
Problem in deploying Entity Bean
Problems while creating Jbosscmp-jdbc.xml file using Xdoclet