Hi

rickard �berg wrote:
> I'm on top if I get more info to work with. Lorenz, can you post the
> primary key source code?

marc fleury wrote:
> I saw the post on transactions... if that is the problem I don't have
enough
> information to say "tada" at once.  More information is good lorenz...
with
> xml files and all

here some parts of my code:
----------------- the home interface
public interface CommissionHome extends EJBHome {

        public Commission create(String anId) throws
RemoteException,CreateException;

        public Commission findByPrimaryKey(CommissionBeanPK primaryKey)
throws RemoteException,FinderException;

        public Enumeration findByNumber(String aNumber) throws
RemoteException,FinderException;
}
----------------- the remote interface
public interface Commission extends EJBObject {

        public String getId() throws RemoteException;

        public String getNumber() throws RemoteException;

        public HCommission getHCommission() throws RemoteException;

        public void setHCommission(HCommission hCommission) throws
RemoteException;
}
----------------- parts of the bean class
public class CommissionBean implements EntityBean {
        public String id = null;
        public String number = null;

        private transient EntityContext context = null;

        public String ejbCreate(String anId) throws CreateException     {
                id = anId;
                return null;
        }
...
        public String getId() {
                return id;
        }

        public String getNumber() {
                return number;
        }

        public HCommission getHCommission() {
                return new HCommission(id, number);
        }

        public void setHCommission(HCommission hCommission) {
                if(id.equals(hCommission.getId()))
                        number = hCommission.getNumber();
        }
----------------- the PK class
public class CommissionBeanPK implements Serializable {
        public String id = null;

        public CommissionBeanPK() {
        }

        public CommissionBeanPK(String id) {
        this.id = id;
        }

        public String toString() {
        return id;
        }
}
----------------- the ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>

<ejb-jar>
    <enterprise-beans>
        <entity>
            <description>commission</description>
            <display-name>Commission</display-name>
            <ejb-name>ejb.Commission</ejb-name>
            <home>com.sympat.problem.CommissionHome</home>
            <remote>com.sympat.problem.Commission</remote>
            <ejb-class>com.sympat.problem.CommissionBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.String</prim-key-class>
            <reentrant>False</reentrant>
            <cmp-field>
                <field-name>id</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>number</field-name>
            </cmp-field>
            <primkey-field>id</primkey-field>
        </entity>
    </enterprise-beans>
    <assembly-descriptor>
        <container-transaction>
            <method>
                <ejb-name>ejb.Commission</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>
----------------- the jaws.xml
<?xml version="1.0" encoding="UTF-8"?>

<jaws>
    <datasource>Hypersonic</datasource>
    <type-mapping>Hypersonic SQL</type-mapping>
    <enterprise-beans>
        <entity>
            <ejb-name>ejb.Commission</ejb-name>
            <table-name>Commission</table-name>
            <create-table>true</create-table>
            <remove-table>false</remove-table>
            <tuned-updates>true</tuned-updates>
            <read-only>false</read-only>
            <time-out>300</time-out>
            <cmp-field>
                <field-name>id</field-name>
                <column-name>ID</column-name>
                <sql-type>CHAR(32)</sql-type>
                <jdbc-type>VARCHAR</jdbc-type>
            </cmp-field>
            <cmp-field>
                <field-name>number</field-name>
                <column-name>Number</column-name>
                <sql-type>CHAR(64)</sql-type>
                <jdbc-type>VARCHAR</jdbc-type>
            </cmp-field>
            <finder>
                <name>findByNumber</name>
                <query>Number = {0}</query>
                <order></order>
            </finder>
        </entity>
    </enterprise-beans>
</jaws>
----------------- 

Hope that helps

J�rgen Lorenz



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to