Code EJB : Lesson - 2 (Continue)

ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
     <ejb-name>CMEntityDemo</ejb-name>
     <home>CMEJBHomeIFace</home>
     <remote>CMEJBRemoteIFace</remote>
     <ejb-class>CMEJB_BeanCode</ejb-class>
     <persistence-type>Container</persistence-type>
     <prim-key-class>CMEJB_PKeyCode</prim-key-class>
     <reentrant>False</reentrant>
     <cmp-field>     <field-name>id</field-name>          </cmp-field>
     <cmp-field>     <field-name>name</field-name>     </cmp-field>
     <cmp-field>     <field-name>password</field-name>     </cmp-field>
     <cmp-field>     <field-name>age</field-name>     </cmp-field>
     <cmp-field>     <field-name>location</field-name>     </cmp-field>
</entity>
</enterprise-beans>
</ejb-jar>
jaws.xml
<jaws>
     <datasource>java:/orclPool</datasource>
     <type-mapping>Oracle8</type-mapping>
     <enterprise-beans>
          <entity>
               <ejb-name>CMEntityDemo</ejb-name>
               <table-name>MyLoginTable</table-name>
               <remove-table>false</remove-table>
               <create-table>true</create-table>
               <cmp-field>
                    <field-name>id</field-name>
                    <column-name>ID</column-name>
          </cmp-field>
               <cmp-field>
                    <field-name>name</field-name>
                    <column-name>NAME</column-name>
               </cmp-field>
               <cmp-field>
                    <field-name>password</field-name>
                    <column-name>PASSWORD</column-name>
               </cmp-field>
               <cmp-field>
                    <field-name>age</field-name>
                    <column-name>AGE</column-name>
               </cmp-field>
               <cmp-field>
                    <field-name>location</field-name>
                    <column-name>LOCATION</column-name>
               </cmp-field>
          </entity>
     </enterprise-beans>
</jaws>
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss>
<secure>false</secure>
<container-configurations />
<resource-managers />
<enterprise-beans>
<entity>
     <ejb-name>CMEntityDemo</ejb-name>
     <jndi-name>EntityBeanViaRemoteIFace</jndi-name>
     <configuration-name></configuration-name>
</entity>
</enterprise-beans>
</jboss>
BUILD.BAT
@ECHO OFF
echo ==== SETTING PATHS CLASSPATHS ===
set CLASSPATH=%CLASSPATH%;.;
path=c:\windows;c:\windows\command;c:\jdk1.3\bin
echo ==== COMPILING ALL SERVERSIDE CODE ===
javac *.java
echo ==== GENERATING .JAR FILE FOR DEPLOYMENT ===
jar -cv0f %1 META-INF *.class
echo ==== DEPLOYING THE JAR ===
copy %1 C:\jbosstomcat\jboss\deploy
echo ==== READY......... START THE SERVER IF NOT STARTED ... AND GO AHEAD ===

wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

Similar Messages

  • Code EJB : Lesson - 8

    [ M E S S A G E - D R I V E N B E A N    C O D E ]
    1.     NewsLetterBean
    DistributeNewsLetterMDB.java
    import javax.ejb.*;
    import javax.jms.*;
    public class DistributeNewsLetterMDB implements MessageDrivenBean,MessageListener
    protected MessageDrivenContext ctx;
    String text;
    public void setMessageDrivenContext(MessageDrivenContext ctx)     {          this.ctx=ctx;     }
    public void ejbCreate()     {     //     System.out.println("ejbcreate");     }
    public void onMessage(Message msg)
         TextMessage tm=(TextMessage) msg;
         try
                   text=tm.getText();
                   System.out.println("NEWS # GOING TO DISTRIBUTE :"+msg);
                   insertMessageToDB();//MUST BE REPLACED WITH JAVAMAIL CODE IN FUTURE
         catch(JMSException e)
                   e.printStackTrace();
    public void ejbRemove()      {       //System.err.println("ejbremove");     }
    void insertMessageToDB() //JavaMAIL should be used to send mail
    try
         Class.forName("oracle.jdbc.driver.OracleDriver");
         java.sql.Connection con=java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.29.62:1521:ORCL","pravash","pravash");
         java.sql.PreparedStatement     stat=con.prepareStatement("Insert into TopicInfo values(?,?)");
         stat.setString(1,"WeeklyNews");
         stat.setString(2,text);
         stat.executeUpdate();
         stat.close();
         con.close();
    catch(Exception e)
         e.printStackTrace();
    ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar>
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeNewsLetter</ejb-name>
    <ejb-class>DistributeNewsLetterMDB</ejb-class>
    <message-selector></message-selector>
    <resource-env-ref-name>WeeklyNewsLetterTopic</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    <resource-ref>
    <res-ref-name>TopicConnectionFactory </res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <subscription-durability>NonDurable</subscription-durability>
    </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>DistributeNewsLetter</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>NotSupported</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <jboss>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeNewsLetter</ejb-name>
    <configuration-name>Standard Message Driven Bean</configuration-name>
    <destination-jndi-name>WeeklyNewsLetterTopic</destination-jndi-name>
    </message-driven>
    </enterprise-beans>
    </jboss>
    BUILD.BAT
    @echo off
    echo COMPILING THE MDBEAN
    javac DistributeNewsLetterMDB.java
    echo CREATING THE JAR FOR DEPLOYMENT
    jar -cv0f DistributeNewsLetterMDB.jar META-INF DistributeNewsLetterMDB.class
    echo DEPLOYING THE JAR FOR USE
    copy DistributeNewsLetterMDB.jar c:\jbosstomcat\jboss\deploy
    echo DEPLOYMENT PROCESS OVER ....

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • Code EJB : Lesson - 2

    [CONTENTS OF ENTITY BEAN]
    {CONTAINER MANAGED PERSISTANCE}
    CMEJBHomeIFace.java
    import javax.ejb.*;
    import java.rmi.*;
    public interface CMEJBHomeIFace extends EJBHome
    public CMEJBRemoteIFace create(int id, String name,String password,int age,String location) throws CreateException,RemoteException;
    /* IN THIS EXAMPLE BOTH THE FOLLOWING METHODS DO THE SAME JOB AS P-KEY AND ID ARE THE SAME FIELD */
    public CMEJBRemoteIFace findById(int id) throws RemoteException,FinderException;
    public CMEJBRemoteIFace findByPrimaryKey(CMEJB_PKeyCode obj) throws RemoteException,FinderException;
    CMEJBRemoteIFace.java
    import javax.ejb.*;
    import java.rmi.*;
    public interface CMEJBRemoteIFace extends EJBObject
    public void setId(int id) throws RemoteException;
    public void setName(String name) throws RemoteException;
    public void setPassword(String password) throws RemoteException;
    public void setAge(int age) throws RemoteException;
    public void setLocation(String location) throws RemoteException;
    public int getId() throws RemoteException;
    public String getName() throws RemoteException;
    public String getPassword() throws RemoteException;
    public int getAge() throws RemoteException;
    public String getLocation() throws RemoteException;
    CMEJB_BeanCode.java
    import javax.ejb.*;
    import java.rmi.*;
    /* ONE ENTITY BEAN INSTANCE ASSOCIATED WITH ONE RECORD OF A TABLE.
    A RECORD IS KNOWN AS AN ENTITY.P-KEY IS REQUIRED TO IDENTIFY THE RECORD.
    P-KEY NEED NOT BE CREATED IN DATABASE, VIRTUAL P-KEY CAN BE MAINTAINED IN THE BEAN ITSELF.
    THIS P-KEY WILL MAINTAIN UNIQUNESS OF RECORD AS LONG AS WE ARE ACCESSING THE TABLE USING ENTITY BEAN.IF WE ACCESS THE TABLE DIRECTLY THROUGH SQL-PLUS AND INSERT DUPLICATE RECORD, ejbLoad() WILL FAIL,NEXT TIME WE TRY TO LOAD*/
    public class CMEJB_BeanCode implements EntityBean
    public int id;
    public String name;
    public String password;
    public int age;
    public String location;
    EntityContext tx;
    public CMEJB_PKeyCode ejbCreate(int id, String name,String password,int age,String location) //same as create() of HomeIFace but return type is different
    System.out.println("#########  Entered ejbCreate of Entity Bean ################");
         this.id = id;
         this.name = name;
         this.password = password;
         this.age = age;
         this.location = location;
         CMEJB_PKeyCode obj = new CMEJB_PKeyCode();
         obj.id = id;
    System.out.println("#########  Exited ejbCreate of Entity Bean ################");
         return obj;
    public void ejbPostCreate(int id, String name,String password,int age,String location) { }
    public void ejbActivate() { }
    public void ejbPassivate(){}
    public void setEntityContext(EntityContext etx)
         tx = etx;
    public void unsetEntityContext() {}
    public void ejbLoad() {} //taken care of by Container... in BMP we have to code it
    public void ejbStore() {}//taken care of by Container... in BMP we have to code it
    public void ejbRemove() {}
    public boolean isModified() // in  ejbStore()it is checked to store latest changes
    {     return true;     }
    public void setId(int id)               {     this.id = id;     }
    public void setName(String name)          {     this.name = name;   }
    public void setPassword(String password)     {     this.password = password;}
    public void setAge(int age)               {     this.age = age;     }
    public void setLocation(String location)     {     this.location = location;}
    public int getId()                    {     return id;          }
    public String getName()               {     return name;     }
    public String getPassword()               {     return password;     }
    public int getAge()                    {     return age;     }
    public String getLocation()               {     return location;     }
    CMEJB_PkeyCode.java
    import javax.ejb.*;
    import java.rmi.*;
    import java.io.*;
    /* used for findByPrimarykey() .used for ejbLoad() and ejbStore().*/
    public class CMEJB_PKeyCode implements Serializable
    public int id; // PKey can be applied to multiple fields
    public int hashCode() // for comparision... when we try to create a record
    {     return id;          }
    public boolean equals(Object o) // for comparision ... when we try to find a record
         CMEJB_PKeyCode pkobj = (CMEJB_PKeyCode) o;
         return (pkobj.id == this.id)?true:false;
    }   }

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • Code EJB : Lesson - 1

    USING REMOTE-I-FACE TO CONNECT EJBs
    [CONTENTS OF STATELESS SESSION BEAN]
    HomeIFace.java
    import java.rmi.*;
    import javax.ejb.*;
    public interface HomeIFace extends EJBHome
    public RemoteIFace create()throws RemoteException,CreateException;
    RemoteIFace.java
    import java.rmi.*;
    import javax.ejb.*;
    import java.util.Vector;
    public interface RemoteIFace extends EJBObject
    public String   insertData(int id,String name,String password,int age,String location)  throws RemoteException;
    public Vector   fetchData()   throws RemoteException;
    BusinessLogicCode.java
    import java.rmi.*;
    import javax.rmi.*;
    import javax.ejb.*;
    import javax.naming.*;
    import java.util.*;
    public class BusinessLogicCode implements SessionBean
    public void ejbCreate(){}
    public void ejbRemove(){}
    public void ejbActivate(){}
    public void ejbPassivate(){}
    public void setSessionContext(SessionContext s){}
    public String insertData(int id,String name,String password,int age,String location)
    System.out.println("\nStateless Beans insertData() Entered ....");
         Properties p;
         Context ctx;
         Object obj;
         CMEJBHomeIFace h;
         CMEJBRemoteIFace rem;
         try
         p=new Properties();
         p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
              p.put(Context.PROVIDER_URL,"jnp://localhost:1099");
              ctx=new InitialContext(p);
              obj=ctx.lookup("EntityBeanViaRemoteIFace");
    h=(CMEJBHomeIFace)PortableRemoteObject.narrow(obj,CMEJBHomeIFace.class);
    rem=h.create(id,name,password,age,location);
    System.out.println("\nStateless Beans insertData() Exited ......");
    return "Inserted Successfully To Entity Bean...";
         catch(Exception e)
              return "Exception While Inserting Record" +e;
    public Vector fetchData()
              //Code to call Finder method of entity bean through LocalInterface
              Vector v1=new Vector();
              v1.addElement("Hello Vector");
              return v1;
    ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
    <ejb-jar>
    <enterprise-beans>
    <session>
    <ejb-name>EjbStatelessDemo</ejb-name>
    <home>HomeIFace</home>
    <remote>RemoteIFace</remote>
    <ejb-class>BusinessLogicCode</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    jboss.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <jboss>
    <secure>false</secure>
    <container-configurations />
    <resource-managers />
    <enterprise-beans>
    <session>
         <ejb-name>EjbStatelessDemo</ejb-name>
         <jndi-name>StatelessRemoteAccessFacility</jndi-name>
         <configuration-name></configuration-name>
    </session>
    </enterprise-beans>
    </jboss>
    BUILD.BAT
    @ECHO OFF
    echo ==== SETTING PATHS CLASSPATHS ===
    set CLASSPATH=%CLASSPATH%;.;
    path=c:\windows;c:\windows\command;c:\jdk1.3\bin
    echo ==== COMPILING ALL SERVERSIDE CODE ===
    javac *.java
    echo ==== GENERATING .JAR FILE FOR DEPLOYMENT ===
    jar -cv0f %1 META-INF *.class
    echo ==== DEPLOYING THE JAR ===
    copy %1 C:\jbosstomcat\jboss\deploy
    copy HomeIFace.class RemoteIFace.class C:\JBossTomcat\tomcat\webapps\MyJsp\WEB-INF\Classes
    echo ==== READY......... START THE SERVER IF NOT STARTED ... AND GO AHEAD ===

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • Code EJB : Lesson - 9

    2.     ScienceNewsBean
    DistributeScienceNewsMDB.java
    import javax.ejb.*;
    import javax.jms.*;
    public class DistributeScienceNewsMDB implements MessageDrivenBean,MessageListener
    protected MessageDrivenContext ctx;
    String text;
    public void setMessageDrivenContext(MessageDrivenContext ctx)     {          this.ctx=ctx;     }
    public void ejbCreate()     {     //     System.out.println("ejbcreate");     }
    public void onMessage(Message msg)
              Open Con to DB
              Get Subscriber List
              Send Mail to Them(JavaMail Preferred)
         TextMessage tm=(TextMessage) msg;
         try
                   text=tm.getText();
                   System.out.println("RECEIVED THE NEWS # GOING TO DISTRIBUTE :"+msg);
                   insertMessageToDB(); //JavaMAIL should be used to send mail
         catch(JMSException e)
                   e.printStackTrace();
    public void ejbRemove()      {       //System.err.println("ejbremove");     }
    void insertMessageToDB() //JavaMAIL should be used to send mail
    try
         Class.forName("oracle.jdbc.driver.OracleDriver");
         java.sql.Connection con=java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.29.62:1521:ORCL","pravash","pravash");
         java.sql.PreparedStatement     stat=con.prepareStatement("Insert into TopicInfo values(?,?)");
         stat.setString(1,"ScienceNews");
         stat.setString(2,text);
         stat.executeUpdate();
         stat.close();
         con.close();
    catch(Exception e)
         e.printStackTrace();
    ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar>
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeScienceNews</ejb-name>
    <ejb-class>DistributeScienceNewsMDB</ejb-class>
    <message-selector></message-selector>
    <resource-env-ref-name>ScienceTopic</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    <resource-ref>
    <res-ref-name>TopicConnectionFactory </res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <subscription-durability>NonDurable</subscription-durability>
    </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>DistributeScienceNews</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>NotSupported</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    jboss.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <jboss>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeScienceNews</ejb-name>
    <configuration-name>Standard Message Driven Bean</configuration-name>
    <destination-jndi-name>ScienceTopic</destination-jndi-name>
    </message-driven>
    </enterprise-beans>
    </jboss>
    BUILD.BAT
    @echo off
    echo COMPILING THE MDBEAN
    javac DistributeScienceNewsMDB.java
    echo CREATING THE JAR FOR DEPLOYMENT
    jar -cv0f DistributeScienceNewsMDB.jar META-INF DistributeScienceNewsMDB.class
    echo DEPLOYING THE JAR FOR USE
    copy DistributeScienceNewsMDB.jar c:\jbosstomcat\jboss\deploy
    echo DEPLOYMENT PROCESS OVER ....

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • Code EJB : Lesson - 10

    3.     SportsNewsBean
    DistributeSportsNewsMDB.java
    import javax.ejb.*;
    import javax.jms.*;
    public class DistributeSportsNewsMDB implements MessageDrivenBean,MessageListener
    protected MessageDrivenContext ctx;
    String text;
    public void setMessageDrivenContext(MessageDrivenContext ctx)     {          this.ctx=ctx;     }
    public void ejbCreate()     {     //     System.out.println("ejbcreate");     }
    public void onMessage(Message msg)
         TextMessage tm=(TextMessage) msg;
         try
                   text=tm.getText();
                   System.out.println("TOPIC: SPORTS # GOING TO DISTRIBUTE :"+msg);
                   insertMessageToDB(); //JavaMAIL should be used to send mail
         catch(JMSException e)
                   e.printStackTrace();
    public void ejbRemove()      {       //System.err.println("ejbremove");     }
    void insertMessageToDB() //JavaMAIL should be used to send mail
    try
         Class.forName("oracle.jdbc.driver.OracleDriver");
         java.sql.Connection con=java.sql.DriverManager.getConnection("jdbc:oracle:thin:@192.168.29.62:1521:ORCL","pravash","pravash");
         java.sql.PreparedStatement     stat=con.prepareStatement("Insert into TopicInfo values(?,?)");
         stat.setString(1,"SportsNews");
         stat.setString(2,text);
         stat.executeUpdate();
         stat.close();
         con.close();
    catch(Exception e)
         e.printStackTrace();
    ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE ejb-jar>
    <ejb-jar>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeSportsNews</ejb-name>
    <ejb-class>DistributeSportsNewsMDB</ejb-class>
    <message-selector></message-selector>
    <resource-env-ref-name>SportsTopic</resource-env-ref-name>
    <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
    <resource-ref>
    <res-ref-name>TopicConnectionFactory </res-ref-name>
    <res-type>javax.jms.TopicConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <transaction-type>Container</transaction-type>
    <message-driven-destination>
    <destination-type>javax.jms.Topic</destination-type>
    <subscription-durability>NonDurable</subscription-durability>
    </message-driven-destination>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>DistributeSportsNews</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>NotSupported</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>
    jboss.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <jboss>
    <enterprise-beans>
    <message-driven>
    <ejb-name>DistributeSportsNews</ejb-name>
    <configuration-name>Standard Message Driven Bean</configuration-name>
    <destination-jndi-name>SportsTopic</destination-jndi-name>
    </message-driven>
    </enterprise-beans>
    </jboss>
    BUILD.BAT
    @echo off
    echo COMPILING THE MDBEAN
    javac DistributeSportsNewsMDB.java
    echo CREATING THE JAR FOR DEPLOYMENT
    jar -cv0f DistributeSportsNewsMDB.jar META-INF DistributeSportsNewsMDB.class
    echo DEPLOYING THE JAR FOR USE
    copy DistributeSportsNewsMDB.jar c:\jbosstomcat\jboss\deploy
    echo DEPLOYMENT PROCESS OVER ....

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • How can I code to play audio continuously from page to page in iBooks for reflow ePub

    Hi,
    I have tried and successfully completed the iBooks ambient soundtrack option in Fixed Layout ePub. It works fine.
    But while trying the same in Reflow ePub, it is not working in iPad iBooks. I have latest iBooks version and latest iOS version in my iPad.
    Please let me know how can I code to play audio continuously from page to page in iBooks for reflow ePub?
    Thanks,
    Sundaram

    As soon as the user turns to the next page, the audio stops.
    That's how it works in all cases.
    the book is a read aloud book.
    See the 'How-To Read Aloud' section in iBA Tips and Tricks 01

  • Code EJB(QL) : Lesson - 12

    EJBQLDemoHomeIFace
    import javax.ejb.*;
    import java.rmi.*;
    import java.util.*;
    public interface EJBQLDemoHomeIFace extends EJBHome
    public EJBQLDemoRemoteIFace create(int id, String name,double salary,int deptno) throws CreateException,RemoteException;
    public EJBQLDemoRemoteIFace findById(int id) throws RemoteException,FinderException;
    public EJBQLDemoRemoteIFace findByPrimaryKey(EJBQLDemoPk obj) throws RemoteException,FinderException;
    public Collection findByName(String name) throws RemoteException,FinderException;
    public Collection findByDeptno(int deptno) throws RemoteException,FinderException;
    public Collection findByAll() throws RemoteException,FinderException;
    EJBQLDemoRemoteIFace
    import javax.ejb.*;
    import java.rmi.*;
    public interface EJBQLDemoRemoteIFace extends EJBObject
    public void setId(int id) throws RemoteException;
    public void setName(String name) throws RemoteException;
    public void setSalary(double salary) throws RemoteException;
    public void setDeptno(int deptno) throws RemoteException;
    public int getId() throws RemoteException;
    public String getName() throws RemoteException;
    public double getSalary() throws RemoteException;
    public int getDeptno() throws RemoteException;
    EJBQLDemoPk
    import javax.ejb.*;
    import java.rmi.*;
    import java.io.*;
    public class EJBQLDemoPk implements Serializable
    public int id;
    public int hashCode()
         return id;
    public boolean equals(Object o)
    EJBQLDemoPk pkobj = (EJBQLDemoPk) o;
    return (pkobj.id == this.id)?true:false;
    EJBQLDemoBeanCode
    import javax.ejb.*;
    import java.rmi.*;
    /* BEAN CLASS MUST BE DECLARED AS AN ABSTRACT CLASS */
    abstract public class EJBQLDemoBeanCode implements EntityBean
    /****************** MEMBER FIELDS ARE NOT REQUIERED ****************************
         public int id;
         public String name;
         public double salary;
         public int deptno;
    private EntityContext tx;
    public EJBQLDemoBeanCode(){}
    public EJBQLDemoPk ejbCreate(int id, String name,double salary,int deptno) throws CreateException // throws is a must here
         setId(id);
         setName(name);
         setSalary(salary);
         setDeptno(deptno);
         return null;
    public void ejbPostCreate(int id, String name,double salary,int deptno) { }
    public void ejbActivate() { }
    public void ejbPassivate(){}
    public void setEntityContext(EntityContext etx){ tx = etx; }
    public void unsetEntityContext() {}
    public void ejbLoad() {}
    public void ejbStore() {}
    public void ejbRemove() {}
    public boolean isModified() {          return true;     }
    /****************** MEMBER METHODS ARE DECLARED ABSTRACT ****************************/
    abstract public void setId(int id);               //{this.id=id;}
    abstract public void setName(String name);     //{this.name=name;}
    abstract public void setSalary(double salary);     //{this.salary=salary;}
    abstract public void setDeptno(int deptno);     //{this.deptno=deptno;}
    abstract public int getId();                    //{return id;}
    abstract public String getName();               //{return name;}
    abstract public double getSalary();               //{return salary;}
    abstract public int getDeptno();               //{return deptno;}
    JSPCient
    <%@ page import="javax.ejb.*,javax.naming.*,java.rmi.*,javax.rmi.*,java.util.*" %>
    <%@ page import="EJBQLDemoHomeIFace,EJBQLDemoRemoteIFace" %>
    <%!
    InitialContext c = null;
    Properties p = null;
    EJBQLDemoHomeIFace homref = null;
    EJBQLDemoRemoteIFace remref = null;
    %>
    <%
    p=new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    p.put(Context.PROVIDER_URL,"jnp://localhost:1099");
    c=new InitialContext(p);
    homref=(EJBQLDemoHomeIFace)c.lookup("EJBQLBean");
    out.println("<h1>Ready....</h1>");
         //CODE TO INSERT A RECORD
         remref=homref.create(104,"DEWANG",5780.0,10);
         out.println("Record Inserted ,...");
         //CODE TO FIND A RECORD
         remref = homref.findById(100);
         out.println("NAME OF THE PERSON : " +remref.getName());
         //CODE TO FIND ALL RECORD
         Iterator i = homref.findByAll().iterator();
         while(i.hasNext())
              remref = (EJBQLDemoRemoteIFace)PortableRemoteObject.narrow(i.next(),EJBQLDemoRemoteIFace.class);
              out.println(remref.getName() + " " + remref.getSalary() );
    %>

    wtf ? what the hell is that ?:-) I wonder how he does it without the EJB QL. Not that I want him to post it.

  • Creation Code EJB

    Dear all,
    is it possible to let Developer studio create the code for calling an ejb automatically?
    the following code is actually always the same and it's not practical to type that code over and over again every time we want to call a method on an EJB...
    InitialContext ctx = new InitialContext();
              TestEJBLocalHome localHome = (TestEJBLocalHome)ctx.lookup("localejbs/TestEJBBean");
              TestEJBLocal bean = localHome.create();
    So it would be nice if there was a way to say to developer studio, this is the bean i want to use, please generate the code so i can call my method on it.
    Kind regards,
    J.

    Joren,
    Almost exactly what you need:
    1. In NW IDE open Window -> Preferences
    2. Navigate to Java -> Editor -> Templates
    Got the idea?
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • One thing really needed is a example code forum  ...continued...

    were people can just drop in and post example code of what ever they like. then instead of asking question's over and over their would be a wealth of code snipets in one place.
    then again it might not be such a good idea.

    there would have to be someone or a group of people that check the code to keep it clean, and good java, so it might get a bit boggy and hard to maintain...
    but a good subject, although i still think that there is sufficient examplecode to find.
    You will practically never find exactely what you need online somewhere cause no application has the same possibilities, features...
    dunno my 2 cents...

  • Replaced CPU same LED error code for CPU problem continues to occur

    I have a dv6-1280us laptop that does not start.  I can hear the optical and HDD, screen is blank the number lock and cap lock LED blinks once between pause.  The chart indicates that the CPU needs to be replaced.  I replaced the CPU with a new one from HP.  I still am getting the same LED error code.  Any suggestions on resolving this problem.  Thanks.

    atlantrace wrote:
    I have a dv6-1280us laptop that does not start.  I can hear the optical and HDD, screen is blank the number lock and cap lock LED blinks once between pause.  The chart indicates that the CPU needs to be replaced.  I replaced the CPU with a new one from HP.  I still am getting the same LED error code.  Any suggestions on resolving this problem.  Thanks.
    It's either a corrupted BIOS or motherboard problem.  Since you've already replaced the CPU, the only other option is to replace the motherboard.

  • How to code EJB in Eclipse IDE

    Hello Forum
    I have downloaded eclipse-SDK-3_1.2-win32.zip and installed but I couldnt findout J2EE development in it
    (that how we add session beans, how we configure application server and how we generate entity beans)
    do I need any plugin to work with J2ee in it,
    Please help me - Thank u very much
    - Tahir

    Sorry, this forum is for questions about the javadoc tool for generating documentation, so you might try elsewhere.

  • Error when opening a EJB code

    Hi All,
    When I try to open by ejb code ( ejb.java file) I am getting the following error
    An internal error occurred during: "Resynching JPA model ...".
    IWAE0011E Key already used to access Resource : org.eclipse.wst.common.internal.emfworkbench.EditModelLeastUsedCache@e55d75
    Please help me in this
    Thanks!
    Swarnaprakash

    Hi,
    First check in
    IMG-FA-FA GS - Tax on sales & Purchase
    1. Check the calculation procedure - TAX<Country> E.g. for India - TAXIN
    2. Check whether the country has been assignmed to the calculation procedure
    3. Calculation - Define Tax codes for Sales / Pur - Enter country and enter tax codes (Tax Type: A: Output tax; v-Input Tax) and give Tax percent
    Save
    It should solve ur problem
    <i>Pls. assign points, if useful</i>
    Regards,
    sridevi

  • EJB client recovery

    Hi,
    I have a java client application using EJBs, and talking to a EJB server (j2ee sdk 1.3) successfully.
    Now I stop the EJB server while the client is running, and restart the server again. I would like my client to recover automatically without the need of stoppin/restarting it.
    When the server stops, my client enters in a 'resume mode' when it tries to recreate new EJBs.
    Unfortunately, when the server is back up and running, the creation of EJBs still raises a MarshallException and it even hangs after a while.
    My approach is a bit innocent, but is there a smarter solution that would work?
    Thanks

    Try to do a clean up at the client code when u determine that the EJB server is down. Is the intent to failover to another ejb server and continue with the session then you may require Sun's enterprise edition which supports sfsb failover.

  • Error while running EJB Client

    Hi All,
    I have just written a program in EJB for currency conversion. But while running the client , i am getting the following error:
    C:\Java Source Code\EJB>java CalculatorClient
    java.lang.NoSuchMethodError: loadClass0
    at com.sun.corba.ee.internal.util.JDKClassLoader.specialLoadClass(Native
    Method)
    at com.sun.corba.ee.internal.util.JDKClassLoader.loadClass(JDKClassLoade
    r.java:58)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClassM(JDKBridge.java:18
    0)
    at com.sun.corba.ee.internal.util.JDKBridge.loadClass(JDKBridge.java:83)
    at com.sun.corba.ee.internal.javax.rmi.CORBA.Util.loadClass(Util.java:37
    8)
    at javax.rmi.CORBA.Util.loadClass(Unknown Source)
    at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(Unknown Sour
    ce)
    at javax.rmi.PortableRemoteObject.<clinit>(Unknown Source)
    at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
    a:57)
    etc........
    The files that have been created are in the same folder which are as follows:
    Calculator.java Calculator.class - Remote Interface
    CalculatorHome.java CalculatorHome.class - Home Interface
    CalculatorEJB.java CalculatorEJB.class - EJB class
    ejbClient.jar - Client Jar
    ejb.ear
    The version for J2EE is 1.2.1
    Version for Jdk is 1.4.2
    Operating System - WinXP
    Could somebody pls help?
    Cooljacks

    ... but you did deploy it to an application server, right?

Maybe you are looking for

  • Unable to load the jdc driver

    Hi, I am using mckoi, but I don't succed in loading the jdbc driver: Class.forName("com.mckoi.JDBCDriver");This line throw a ClassNotFoundException. But: cd $CLASSPATH; ls | grep mkjdbc.jar mkjdbc.jar So the jar file is in the CLASSPATH. I try also:

  • Your update 33.0 is not compatable with Norton antivirus and the screen only turns black when trying to open firefox. Please help

    Please see question. I have tried uninstalling and reinstalling, but with no success. Chrome and Int. Exp both work fine, but nothing comes up but a black screen covering most of my monitor in Firefix.

  • Invoice Verification MIRO

    Dear All, This is about invoice verification block after MIRO posting- In PO we have set it as 2 way match, once the PO is equal to Invoice verification then the system should not put any payment block. But if it doesnt match the value of PO to IV th

  • Java null pointer exception in Executing interface

    I am using MS Access as source table. I am populating this data into oracle target table. when i execute the interface I get the following error in in the LKM. java.lang.NullPointerException      at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDri

  • CSS Import.bat getting error in shared services

    hi i am successfully export the users using CSSExport.bat using the importexport.properties from hyperion 9.2.1 and when i am trying to import using CSSImport.bat and i am getting below errors 28:8015:Invalid export file. specific a valid file path i