It's BMP: he's just getting a value for his primary key field. achandra wrote: > CMP = Container Managed Persistance > BMP = Bean Managed Persistance > > you must first understand what is a CMP and what a BMP is > > what you are doing is a BMP ejb > if you are using CMP, the container (jboss) will handle > the connection and update of data > > adam > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Ricky > Sent: Saturday, March 10, 2001 10:41 AM > To: JBoss-User > Subject: [jBoss-User] Simple question to ask about ejb > > > > Hi all , i am using jBoss-FINAL_2.0 container . > My question is that can i do open Connection in the CMP bean in > ejbCreate() . > Any wrong with that ? Is violated the EJB specification ?? > > Please commment. Below is the CMP bean code: > > > public UsersPK ejbCreate(String username,String password,boolean > isadmin) throws CreateException { > > Connection conn = null; > PreparedStatement ps = null; > ResultSet rs = null; > > try{ > conn = this.getConnection(); > ps = conn.prepareStatement("Select NEXTVAL('userproject_seq') from > test_seq"); > rs = ps.executeQuery(); > > if(rs.next()){ > this.userid = rs.getInt(1); > } > } > catch(SQLException se){} > finally{ > try{ > if(conn != null) conn.close(); > if(rs != null ) rs.close(); > if(ps != null ) ps.close(); > } > catch(SQLException se){} > } > > this.username = username; > this.password = password; > this.isadmin = isadmin; > > return null; > > } > > > -- > -------------------------------------------------------------- > To subscribe: [EMAIL PROTECTED] > To unsubscribe: [EMAIL PROTECTED] > > > > -- > -------------------------------------------------------------- > To subscribe: [EMAIL PROTECTED] > To unsubscribe: [EMAIL PROTECTED] -- -------------------------------------------------------------- To subscribe: [EMAIL PROTECTED] To unsubscribe: [EMAIL PROTECTED]
