1 Reply Latest reply on Jun 22, 2005 1:49 AM by bbbear

    Using postgre on Jboss EJB Entity bean

    giscard_aioba

      Hi guys, I am here again, and I have another "simple"question (I swear that I won't do these kind of question as soon as...:-)

      Well, I am developing a simple entity bean, but I don't know how to bind my resource database(setted on the ejb-jar.xml file) with a jar driver file and the postgresql database!!!!! Where I point the jboss to use the postgre and where I set the "jndi name to access it".

      Well, if anyone can point me a tutorial or online documentation will be very helpful too....

      Thanks all

        • 1. Re: Using postgre on Jboss EJB Entity bean
          bbbear

          I use XDoclet to generate those relevant DD for the entity beans. Have a look at http://xdoclet.sourceforge.net/xdoclet/index.html

          Look at @ejb and @jboss tag if you're using JBoss as the app server.

          Sample usage will be (at the bean implementation class):

          Not all tags needed is in this sample
          /**
          * @ejb.bean name = "AnEntity"
          * type = "CMP"
          * display-name = "AnEntity"
          * description = "AnEntity EJB"
          * view-type = "remote"
          * jndi-name = "ejb/AnEntity"
          * primkey-field = "id"
          *
          * @jboss.cmp-field field-name="id" column-name="Id"
          * @jboss.cmp-field field-name="column2" column-name="column2"
          *
          * @jboss.persistence
          * datasource="java:/PostgresPool"
          * datasource-mapping="PostgreSQL"
          * table-name="table_name"
          */
          public abstract class AnEntity implements EntityBean {
          ...
          ...
          }

          [Note] The '@jboss.persistence' is where you declared your bean to map to which datasource and table.

          Hope this help.

          Regards,
          bb