[jboss-user] [EJB/JBoss] - Re: Composite Primary Key In a single table

prasanths do-not-reply at jboss.com
Thu Oct 23 02:00:15 EDT 2008


Hi,

I have a table which is having composite primary key(id,name), Can anyone tell me how to provide composite primary key in ejb-jar.xml.

For primary key we can give like this:--

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>
  <enterprise-beans>
    
      <ejb-name>ProductEJB</ejb-name>
      com.javasrc.licenseserver.ejb.product.ProductHomeRemote
      com.javasrc.licenseserver.ejb.product.ProductRemote
<ejb-class>com.javasrc.licenseserver.ejb.product.ProductBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Product</abstract-schema-name>
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>name</field-name></cmp-field>	 
      <primkey-field>id</primkey-field>	   
      <security-identity><use-caller-identity/></security-identity>
    
  </enterprise-beans>
  <assembly-descriptor>
    <container-transaction>
      
        <ejb-name>ProductEJB</ejb-name>
        <method-name>*</method-name>
      
      <trans-attribute>Required</trans-attribute>
    </container-transaction>
  </assembly-descriptor> 
</ejb-jar>

pls provide me solution for entering composite primary key.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184037#4184037

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184037



More information about the jboss-user mailing list