File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes ejbPostCreate doesn't execute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ejbPostCreate doesn Watch "ejbPostCreate doesn New topic
Author

ejbPostCreate doesn't execute

Kalle Anka
Ranch Hand

Joined: Jul 06, 2005
Posts: 69
Hi everyone,

I'm using EJB 2.1 and I'm new to J2EE. I experience some problems with CMR so I'm trying to debug my code with some silly System.out.println statements, and I found that ejbPostCreate(...) doesn't execute for some reason unexplainable. Can anyone shed some light into this?

I've attached parts of the code below. When I run this code only "yoyo1" is displayed... leaving "yoyo2" in ejbPostCreate out.


/**
*
* @ejb.bean name="UserBevaka"
* display-name="Name for UserBevaka"
* description="Description for UserBevaka"
* local-jndi-name = "ejb/UserBevaka"
* type="CMP"
* cmp-version="2.x"
* view-type="local"
* primkey-field = "uniktBevakningsID"
* schema="userBevakaSchema"
*
* @ejb.pk class = "java.lang.Integer"
*
* @ejb.persistence table-name="userbevaka"
*
* @ejb.home generate="local" local-class="test.interfaces.UserBevakaLocalHome"
* @ejb.interface generate="local" local-class="test.interfaces.UserBevakaLocal"
*
* @jboss.entity-command name="mysql-get-generated-keys"
*
*/
public abstract class UserBevakaBean implements EntityBean {

.
.
.

/**
* Create method
* @ejb.create-method view-type = "local"
*/
public java.lang.Integer ejbCreate(
java.lang.String username,
java.lang.Integer uniktAnstalldID,
AnstalldLocal anstalld) throws javax.ejb.CreateException {
System.out.println("yoyo1");
setUsername(username);
setUniktAnstalldID(uniktAnstalldID);
setCreateDate(new java.sql.Date(new java.util.Date().getTime()));
return null;
}
/**
* Post Create method
*/
public void ejbPostCreate(
java.lang.String username,
java.lang.Integer uniktAnstalldID,
AnstalldLocal anstalld) throws javax.ejb.CreateException {
System.out.println("yoyo2");
setAnstalld(anstalld);
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ejbPostCreate doesn't execute
 
Similar Threads
ejbCreate, primary keys and deployment descriptors question
CreateFailureException
JBoss Primary Key Generation
Entity Bean not inserted in my table ... no runtime error
WebSphere V5 CMP create problem