Java.io.NotSerializableException - while retriving "one to many" objects

i am getting java.rmi.MarshalException java.io.NotSerializableException
while i try to retrive one to many objects
i have recently migrated from kodo 2.5.x to kodo 3.0.1, and i have parent
object reference in child objects (reverse mapping reference according to
kodo 2.5.x) as shown below
public class BankStatementEntry implements BankStatement {
private Set accountSummary = new HashSet();
public interface BankStatement extends Serializable {
* Returns the accountSummary.
* @return Map
public Set getAccountSummary();
* Returns the accountSummary.
* @return Map
public void setAccountSummary(Set accountSummary);
public class AccountSummaryRecord implements AccountSummary {
private BankStatementEntry bankStatementEntry;
public interface AccountSummary extends Serializable {
     * Returns the transactionDetails.
     * @return Collection
     public Set getTransactionDetails();
the problem is, when i try to retrive BankStatementEntry object, i have to
iterate through each child (AccountSummaryRecord) object and manualy
remove parent object reference (BankStatementEntry) by setting null.
Otherwise EJB throws java.io.NotSerializableException
Is this bug ?
Thanks
karup.

Thread [Servlet.Engine.Transports : 1] (Suspended)
     java.io.NotSerializableException.<init>() line: 50 [local variables
unavailable]
     com.ibm.CORBA.iiop.UtilDelegateImpl.copyObjectByProxy(java.lang.Object,
org.omg.CORBA.ORB, java.lang.ClassLoader, java.lang.Class,
org.omg.CORBA.portable.Streamable) line: 1316 [local variables unavailable]
     com.ibm.ws.orb.WSUtilDelegateImpl(com.ibm.CORBA.iiop.UtilDelegateImpl).copyObject(java.lang.Object,
org.omg.CORBA.ORB) line: 771 [local variables unavailable]
     javax.rmi.CORBA.Util.copyObject(java.lang.Object, org.omg.CORBA.ORB)
line: 327 [local variables unavailable]
     au.com.aig.aiaa.paymentdishonor.process.ejb._BankStatementProcessor_Stub.fetchBankStatement(java.util.Date,
java.util.Date) line: 366
     au.com.aig.aiaa.business.process.ejb.CommonFacadeBean.fetchBankStatement(java.util.Date,
java.util.Date) line: 102
     au.com.aig.aiaa.business.process.ejb.EJSRemoteStatelessCommonFacade_aa40cc36.fetchBankStatement(java.util.Date,
java.util.Date) line: 61
     au.com.aig.aiaa.business.process.ejb._CommonFacade_Stub.fetchBankStatement(java.util.Date,
java.util.Date) line: 266
     au.com.aig.aiaa.paymentdishonor.web.ReportsAction.execute(org.apache.struts.action.ActionMapping,
org.apache.struts.action.ActionForm,
javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 67
     org.apache.struts.action.RequestProcessor.processActionPerform(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, org.apache.struts.action.Action,
org.apache.struts.action.ActionForm,
org.apache.struts.action.ActionMapping) line: 446
     org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 266
     org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 1292
     org.apache.struts.action.ActionServlet.doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 492
     org.apache.struts.action.ActionServlet(javax.servlet.http.HttpServlet).service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 740
     org.apache.struts.action.ActionServlet(javax.servlet.http.HttpServlet).service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 853
     com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 110 [local variables unavailable]
     com.ibm.ws.webcontainer.servlet.StrictServletInstance(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet)._service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 174 [local variables unavailable]
     com.ibm.ws.webcontainer.servlet.IdleServletState.service(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet,
javax.servlet.ServletRequest, javax.servlet.ServletResponse) line: 313
[local variables unavailable]
     com.ibm.ws.webcontainer.servlet.StrictServletInstance(com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet).service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 116 [local variables unavailable]
     com.ibm.ws.webcontainer.servlet.ServletInstance.service(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 258
[local variables unavailable]
     com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(com.ibm.ws.webcontainer.servlet.ServletInstanceReference,
javax.servlet.ServletRequest, javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 42
[local variables unavailable]
     com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
com.ibm.ws.webcontainer.webapp.WebAppServletInvocationEvent) line: 40
[local variables unavailable]
     com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(com.ibm.ws.webcontainer.webapp.WebAppRequest,
javax.servlet.http.HttpServletResponse) line: 872 [local variables
unavailable]
     com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, boolean) line: 491 [local variables
unavailable]
     com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) line: 173 [local variables unavailable]
     com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) line: 79 [local variables
unavailable]
     com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(java.lang.Object)
line: 199 [local variables unavailable]
     com.ibm.ws.webcontainer.srt.WebAppInvoker(com.ibm.ws.webcontainer.cache.invocation.CachedInvocation).handleInvocation(java.lang.Object)
line: 71 [local variables unavailable]
     com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(java.lang.Object)
line: 114 [local variables unavailable]
     com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(java.lang.String,
com.ibm.ws.webcontainer.srp.ISRPConnection) line: 187 [local variables
unavailable]
     com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(com.ibm.ws.webcontainer.oselistener.api.IOSEConnection)
line: 331 [local variables unavailable]
     com.ibm.ws.webcontainer.http.HttpConnection.handleRequest() line: 56
[local variables unavailable]
     com.ibm.ws.webcontainer.http.HttpConnection(com.ibm.ws.http.HttpConnection).readAndHandleRequest()
line: 432 [local variables unavailable]
     com.ibm.ws.webcontainer.http.HttpConnection(com.ibm.ws.http.HttpConnection).run()
line: 343 [local variables unavailable]
     com.ibm.ws.util.ThreadPool$Worker.run() line: 592 [local variables
unavailable]

Similar Messages

  • Help with multi-table mapping for one-to-many object inheritance

    Hi,
    I have posted on here before regarding this (Toplink mapping for one-to-many object inheritance but I am still having problems mapping my object model to my schema.
    Object model
    The Person and Organisation objects contain base information and have the primary keys person_id and organisation_id. It is important that there is no duplication of person and organisation records, no matter how many times they are saved in different roles.
    There are two types of licenceholder in the problem domain, and the ILicenceHolder interface defines information and methods that are common to both. The PersonalLicenceHolder object represents one of these types of licenceholder, and is always a person, so this class extends Person and implements ILicenceHolder.
    The additional information and methods that are required by the second type of licenceholder are defined in the interface IPremisesLicenceHolder, which extends ILicenceHolder. Premises licence holders can either be people or organisations, so I have two objects to represent these - PremisesLicenceHolderPerson which implements IPremisesLicenceHolder and extends Person, and PremisesLicenceHolderOrganisation which implements IPremisesLicenceHolder and extends Organisation.
    The model is further complicated by the fact that any single Person may be both a PersonalLicenceHolder and a PremisesLicenceHolderPerson, and may be so several times over. In this case, the same basic Person information needs to be linked to several different sets of licenceholder information. In the same way, any single Organisation may be a PremisesLicenceHolderOrganisation several times over.
    Sorry this is complicated!
    Schema
    I have Person and Organisation tables containing the basic information with the primary keys person_id and organisation_id.
    I have tried to follow Donald Smith's advice and have created a Role table to record the specialised information for the different types of licence holder. I want the foreign keys in this table to be licenceholder_id and licence_id. Licenceholder_id will reference either organisation_id or person_id, and licence_id will reference the primary key of the Licence table to link the licenceholder to the licence. Because I am struggling with the mapping, I have changed licenceholder_id to person_id in an attempt to get it working with the Person object before I try the Organisation.
    Then, when a new licenceholder is added, if the person/organisation is already in the database, a new record is created in the Role table linking the existing person/organisation to the existing licence rather than duplicating the person/organisation information.
    Mapping
    I am trying to use the toplink mapping workbench to map my PremisesLicenceHolderPerson object to my schema. I have mapped all inherited attributes to superclass (Person). The primary table that the attributes are mapped to is Person, and I have used the multi-table info tab to add Roles as an additional table and map the remaining attributes to that.
    I have created the references PERSON_ROLES which maps person.person_id to roles.person_id, ROLES_PERSON which maps roles.person_id to person.person_id and ROLES_LICENCE which maps roles.licence_id to licence.licence_id.
    I think I have put in all the relationships, but I cannot get rid of the error message "The following primary key fields are unmapped: PERSON_ID".
    Please can somebody tell me how to map this properly?
    Thank you.

    I'm not positive about your mappings, but it looks like the Person object should really have a 1:M or M:M mapping to the Licenceholder table. This then means that your object model should be similar, in that Person object could have many Licenses, instead of being LicenceHolders. From the looks of it, you have it set up from the LicenceHolder perspective. What could be done instead if a LicenceHolder could have a 1:1 reference to a person data object, rather than actually be a Person. This would allow the person data to be easily shared among licences.
    LicenceHolder1 has an entry in the LicenceHolder table and Person table. LicenceHolder2 also has entries in these tables, but uses the same entry in the Person table- essentially it is the same person/person_ID. If both are new objects, TopLink would try to insert the same person object into the Person table twice. I'm not sure how you have gotten around or are planning to get around this problem.
    Since you are using inheritance, it means that LicenceHolder needs a writable mapping to the person.person_id field- most commonly done through a direct to field mapping. From the description, it looks like roles.person_id is a foreign key in the multiple table mapping, meaning it would be set based on the value in the person.person_id field, but the person.person_id isn't actually mapped in the object. Check to make sure that the ID attribute LicenceHolder is inheriting from person hasn't been remapped in the LicenceHolder descriptor to a different field.
    Best Regards,
    Chris

  • Toplink mapping for one-to-many object inheritance

    Hi
    I currently have a Person object, extended by two specialist classes, PremisesLicenceHolder and PersonalLicenceHolder. I have mapped this in Toplink and it works fine saving a person into the specialist tables using the primary key person_id.
    However, a single Person may be extended any number of times by either one or both of the two specialist types. So, a Person may be a PremisesLicenceHolder many times over for different premises and licences, and also a PersonalLicenceHolder several times over.
    Is it possible to map this object model in Toplink avoiding duplicate person_id primary keys in the specialist tables?
    Thanks

    Hi,
    I am happy that my object model fits the problem domain. The Person and Organisation objects contain base information and have the primary keys person_id and organisation_id. It is important that there is no duplication of person and organisation records, no matter how many times they are saved in different roles.
    There are two types of licenceholder in the problem domain, and the ILicenceHolder interface defines information and methods that are common to both. The PersonalLicenceHolder object represents one of these types of licenceholder, and is always a person, so this class extends Person and implements ILicenceHolder.
    The additional information and methods that are required by the second type of licenceholder are defined in the interface IPremisesLicenceHolder, which extends ILicenceHolder. Premises licence holders can either be people or organisations, so I have two objects to represent these - PremisesLicenceHolderPerson which implements IPremisesLicenceHolder and extends Person, and PremisesLicenceHolderOrganisation which implements IPremisesLicenceHolder and extends Organisation.
    The model is further complicated by the fact that any single Person may be both a PersonalLicenceHolder and a PremisesLicenceHolderPerson, and may be so several times over. In this case, the same basic Person information needs to be linked to several different sets of licenceholder information. In the same way, any single Organisation may be a PremisesLicenceHolderOrganisation several times over.
    Sorry this is complicated!
    My initial idea for the schemas is to have Person and Organisation tables containing the basic information with the primary keys person_id and organisation_id. The Person table would have a one-to-many relationship with both the PersonalLicenceHolder table (pk: personalLicenceHolder_id, fk: person_id), and the PremisesLicenceHolderPerson table (pk: premisesLicenceHolderPerson_id, fk: person_id). There would also be a one-to-many relationship between the Organisation table and the PremisesLicenceHolderOrganisation table (pk: premisesLicenceHolderOrganisation_id, fk: organisation_id).
    I am flexible as to the design of my schema though, as I am happy to adopt any that will facilitate the Toplink Mapping.
    Thanks for your help with this.

  • Java.lang.NumberFormatException while retriving detail in jsp page

    inside ActionClass(in struts i have )i am taking msgno as a input
    ArrayList arry=new ArrayList();
    Message msg=null;
    Address[] from=null;
    Date date=null;
    Address[] recipients=null;
    String subject=null;
    String contType=null;
    Object msgBody=null;
    BodyBn bbn=null;
    System.out.println("inside bussiness");
    Properties props = new Properties( );
    props.put("mail.debug","true");
    final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
    final String host = "pop.gmail.com";
    final String port="995";
    final String username = "[email protected]";//my mail id
    final String password = "######### "; //my password
    String provider = "pop3";
    props.put("mail.pop3.host",host);
    props.put("mail.pop3.user",username);
    props.put("mail.pop3.port",port);
    props.setProperty( "mail.pop3.socketFactory.port", "995");
    props.setProperty( "mail.pop3.socketFactory.class", SSL_FACTORY);
    props.setProperty("mail.pop3.socketFactory.fallback", "false");
    try {
    Session session = Session.getInstance(props,new javax.mail.Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(username,password);     }
    Store store = session.getStore(provider);
    store.connect(host, username, password);
    boolean b=store.isConnected();
    if(b==true) {
    System.out.println("************conneted to pop server***********");
    Folder inbox = store.getFolder("INBOX");
    if (inbox == null) {
    System.out.println("No INBOX");
    System.exit(1);
    inbox.open(Folder.READ_ONLY);
    msg = inbox.getMessage(msgno);
    from= msg.getFrom();
    date=msg.getSentDate();
    recipients=msg.getAllRecipients();
    subject=msg.getSubject();
    contType= msg.getContentType();
    msgBody=msg.getContent();
    System.out.println("msg is from "+from);
    System.out.println("msg date "+date);
    System.out.println("msg recipients "+recipients);
    System.out.println("msg sub is "+subject);
    System.out.println("msg conttype "+contType);
    System.out.println("msg body is "+msgBody);
    bbn=new BodyBn(from,date,recipients,subject,contType,msgBody);
    System.out.println("----------adding to arry list--------------");
    arry.add(bbn);
    req.setAttribute("msgDetail",arry);
    return mapping.findForward("success");
    }catch(Exception e) {
    System.out.println("Exception***********");
    ------------------------------in jsp page i m retriving all data--------------------------------
    <body>
    <logic:present name="msgDetail">
    <table>
    <tr>
    <td>${msgDetail.from[0]}</td>
    </tr>
    <tr>
    <td>${msgDetail.recipients[0]}</td>
    </tr>
    <tr>
    <td>${msgDetail.subject}</td>
    </tr>
    <tr>
    <td>${msgDetail.contType}</td>
    </tr>
    <tr>
    <td>${msgDetail.msgBody}</td>
    </tr>
    </table>
    </logic:present>
    while printing these data in to console it is showing all data properly
    but when i am trying to access these data from jsp page it is giving me
    Following exception
    java.lang.NumberFormatException: For input string: "from"
         java.lang.NumberFormatException.forInputString(Unknown Source)
         java.lang.Integer.parseInt(Unknown Source)
         java.lang.Integer.parseInt(Unknown Source)
         javax.el.ListELResolver.coerce(ListELResolver.java:166)
         javax.el.ListELResolver.getValue(ListELResolver.java:51)
         javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
    Plz help for this problem

    This problem doesn't seem to have anything to do with JavaMail.
    You'll probably have better luck in a Struts or JSP forum.

  • One to many relationship in hibernate

    I am very much new to hibernate,
    for testing purpose I am using JPA annotations and hibernate.
    While testing one to many relationship , I got a problem
    I have a PurchaseOrder class and OrderLine class having one to many relationship.
    package orderpackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.persistence.CascadeType;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.OneToMany;
    @Entity
    public class PurchaseOrder {
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private int id;
      @OneToMany(cascade=CascadeType.ALL,mappedBy="order")
      private List <OrderLine> orderLine = new ArrayList<OrderLine>();
      public PurchaseOrder(String orderName) {
      this.orderName = orderName;
      public List<OrderLine> getOrderLine() {
      return orderLine;
      public void setOrderLine(List<OrderLine> orderLine) {
      this.orderLine = orderLine;
      private String orderName;
      public int getId() {
      return id;
      public void setId(int id) {
      this.id = id;
      public String getOrderName() {
      return orderName;
      public void setOrderName(String orderName) {
      this.orderName = orderName;
    OrderLine.java
    package orderpackage;
    import javax.persistence.CascadeType;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.ManyToOne;
    @Entity
    public class OrderLine {
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private int id;
      private String itemName;
      private int qty;
      @ManyToOne(cascade=CascadeType.ALL)
      private PurchaseOrder order;
      public OrderLine(String itemName, int qty) {
      this.itemName = itemName;
      this.qty = qty;
      public PurchaseOrder getOrder() {
      return order;
      public void setOrder(PurchaseOrder order) {
      this.order = order;
      public int getId() {
      return id;
      public void setId(int id) {
      this.id = id;
      public String getItemName() {
      return itemName;
      public void setItemName(String itemName) {
      this.itemName = itemName;
      public int getQty() {
      return qty;
      public void setQty(int qty) {
      this.qty = qty;
         OrderTest.java
    package orderpackage;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    public class OrderTest {
      public static void main(String[] args) {
      PurchaseOrder order = new PurchaseOrder("order no 1");
      OrderLine orderLine1 = new OrderLine("item1",25);
      OrderLine orderLine2 = new OrderLine("item2",28);
      OrderLine orderLine3 = new OrderLine("item3",38);
      OrderLine orderLine4 = new OrderLine("item4",48);
      order.getOrderLine().add(orderLine1);
      order.getOrderLine().add(orderLine2);
      order.getOrderLine().add(orderLine3);
      order.getOrderLine().add(orderLine4);
      SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
      Session session = sessionFactory.openSession();
      session.beginTransaction();
      session.persist(order);
      session.getTransaction().commit();
      session.close();
    I can see Order and Order Line are get persisted but Order Line table don't have order_id populated automatically. Please help me out.

    That is because you're not setting it, obviously. Nowhere in your code are you actually populating the order property of the orderlines.

  • One to many subqueries?

    Hi,all
    I have two tables:
    CREATE TABLE UserInfoTable (
    loginId VARCHAR(32) CONSTRAINT pk_userLoginId
    PRIMARY KEY,
    regionId NUMBER(12),
    accountId NUMBER(12) NOT NULL)
    CREATE TABLE AccountTable
    accountId NUMBER(12) NOT NULL PRIMARY KEY)
    i have established the two master tables on the master site,but
    when i create snapshot as:
    CREATE SNAPSHOT test.AccountTable ON PREBUILT TABLE
    REFRESH FORCE
    START WITH to_date('20/12/2001 07:39:49 am','dd-Mon-yyyy
    HH:MI:SS am')
    NEXT /*1:Hr*/ sysdate + 1/(30*24)
    FOR UPDATE
    AS select * from [email protected] A where
    exists (select 1 from [email protected] B
    where A.accountId = B.accountId and B.regionId = 2)
    i got the following error:
    ORA-12013:updatable snapshots must be simple enough to do
    fast refresh!
    i have create snapshot log on userinfotable.accountId and
    userinfotable.regionid on master site.but if i get rid of the
    above "FOR UPDATE",then it works well.
    this subquery is one to many subqueries?
    the document of oracle 9i said:
    Note: The materialized view site must have a compatibility level
    of 9.0.0 or higher because fast refresh of materialized views
    with one to many subqueries was not supported prior to release
    9.0.0 of Oracle. The compatibility level is controlled by the
    COMPATIBLE initialization parameter.
    i use Oracle enterprise edition 8.1.7.so it can't do updatable
    snapshots while using one to many subqueries?
    Anybody can help me?i have wandered on this problem serveral
    days.
    thanks in advance!

    .. do you know if there are firewalls that can implement one-to-many nat ? tipically one private ip statically natted to many public ip .. checkpoint, fortigate ..

  • One to Many Using an Interface

    I have a one to many object mapping. There is a foreign key on the many table that is not being auto populated when it gets added to the one object. Is this normal activity? I would think that this column would not have to be explicitly set.
    Also, I am using sequencing on the primary key of both the one object and the many object.
    Following is a simplified code excert of what I am doing. Could I be doing something wrong?
    Thanks,
    Michael
    public void testAddManyObject(OneObject oneObject){
    UnitOfWork uow = this.getUnitOfWork();          
    ManyObject manyObject = new ManyObject();
    uow.assignSequenceNumber(manyObject);
    payoff.setRandomValue("10000");          
    oneObject.addManyObject(manyObject);
    uow.registerObject(payoff);
    uow.commit();
         }

    (I am assuming that "payoff" is your "oneObject", otherwise I'm not sure of it's relevance in the example).
    Does your addMany(Many aMany) look like this:
    public void addMany(Many aMany) {
    manyCollection.add(aMany);
    aMany.setOne(this);
    In other words, it's the 1-1 back reference that's really important in a 1-M... You shouldn't have to force the assignment of sequence numbers unless you want it for your business domain for some reason.
    - Don

  • Urgent : java bean having bidirectional one to many relationship

    Hi,
    We have complex requirement in our application.
    We need to copy java bean having bidirectional one to many relationship to another javabean having bidirectional one to many relationship..
    E.g
    Class Basket1 {
    public String color;
    pubic String type;
    public List<Basket1> basketList = new ArrayList()
    Class Basket2 {
    public String color;
    pubic String type;
    public List<Basket2> basketList = new ArrayList()
    We need to exact copy Basket1 to Basket2. We are in trouble to copy List of child because we do not have how many child Basket1 have of same type..
    Can someone help us how we can implement such kind of complex object bidirectional one to many relationship??

    I can't see anything bidirectional about these relationships. What I can see is a couple of BasketN classes that look identical so I don't know why they both exist, and they both contain lists of themselves as members, which suggests some kind of tree structure. Nothing bidirectional there. I can see tat these things can form circular object graphs but I don't see why you would want to do that.
    We need to exact copy Basket1 to Basket2And I don't know what that means. Please explain.

  • One to many chat in java

    is there any way to provide One to many chatting on LAN. i am trying to do that but i am not able to construct the basic architecture that how actually it should work.
    if anybody who is having any idea that what should be the basic architecture of One to many chatting on LAN then please reply.
    thank you

    shadtab wrote:
    is there any way to provide One to many chatting on LAN. i am trying to do that but i am not able to construct the basic architecture that how actually it should work.
    if anybody who is having any idea that what should be the basic architecture of One to many chatting on LAN then please reply.
    thank youI've made a simple one to many chatting using JMS topic subscriber/publisher

  • Java.io.NotSerializableException

    I am running iplanet ias 6.0 sp3 with web server 6.0 sp1. I
    successfully deployed an ear file that contains the war and the jar to
    the APPS dir. The session ejbs and the entity ejbs are packed into the
    jar file which are deployed with the ear.
    I have two piece of testing code. One is a standalone java program.
    The other one is a jsp page together with the jsp bean which are packed
    into the war file in the ear. The jsp bean code and the standalone
    program are doing the same thing. They call a session ejb which calls an
    entity bean.
    I have made 2 experiments
    1> Start server, run the standalone test, got the correct result.
    Then run the jsp from the browser, got the correct result.
    2> Start server, run the jsp from the browser, fail to get the
    result. run the standalone test, fail to get the result
    The paten is very consistent. The code and the error msg for test 2 are
    attached. Could any one tell me what might cause the problem in the
    second test and how to resolve the it ?
    Thank in advance
    Xiao
    When the test fails, I got the following error msg from the console.
    [10/Nov/2001 12:08:08:3] info: --------------------------------------
    [10/Nov/2001 12:08:11:0] error: EBFP-serialize: error during
    serialization of me
    thod, exception = java.io.NotSerializableException: java.util.Vector$1
    java.io.NotSerializableException: java.util.Vector$1
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at
    java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:811)
    at
    java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOut
    putStream.java:432)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:337)
    at
    java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:
    1567)
    at
    java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java
    :453)
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at com.kivasoft.ebfp.FPSerializable.serialize(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    [10/Nov/2001 12:08:11:0] warning: EB-invalidate_delegate: instance
    com.plateausy
    [email protected] threw
    an unche
    cked or system exception, ex = ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    [10/Nov/2001 12:08:11:0] error: Exception Stack Trace:
    ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.HolidayProfileManagerBe
    an.getHolidayProfileHolidays(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_skel_com_plateausys
    tems_elms_bo_holidayprofile_ejb_HolidayProfileManagerBean.getHolidayProfileHolid
    ays(ejb_skel_com_plateausystems_elms_bo_holidayprofile_ejb_HolidayProfileManager
    Bean.java:207)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_kcp_skel_HolidayPro
    fileManager.getHolidayProfileHolidays__seq_com_plateausystems_elms_bo_holidaypro
    __13918743(ejb_kcp_skel_HolidayProfileManager.java:326)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    ERROR [Thread-37] (?:?) - <HolidayProfileManagerJB:getHolidayVOs>Can't
    get Holid
    ayVOs by holiday profile id.java.rmi.ServerException: RemoteException
    occurred i
    n server thread; nested exception is:
    javax.transaction.TransactionRolledbackException
    *************************************************************end of
    error msg
    The attached is session and entity bean code segment.
    In the entity bean:
    public Enumeration ejbFindByHolidayProfileID(String id) {
    Vector list = new Vector();
    try {
    Connection connection = DBUtil.getConnection();
    try {
    PreparedStatement s =
    connection.prepareStatement(sqlFindByHolidayProfileID);
    try {
    s.setString(1, id);
    ResultSet rs = s.executeQuery();
    try {
    while (rs.next()) {
    HolidayProfileHolidayPK pk = new
    HolidayProfileHolidayPK();
    pk.holidayProfileID = rs.getString("hol_prfl_id");
    pk.holidayID = rs.getString("hol_id");
    list.add(pk);
    } finally {
    rs.close();
    } finally {
    s.close();
    } finally {
    connection.close();
    } catch (Exception e) {
    throw new EJBException(e);
    return list.elements();
    In the session bean:
    public HolidayProfileHolidayVO[] getHolidayProfileHolidays(String
    holidayProfileID) throws ElmsFinderException
    HolidayProfileHolidayVO[] vos = null;
    ArrayList alst = new ArrayList();
    HolidayProfileHolidayHome hphHome =
    this.getHolidayProfileHolidayHome();
    try {
    java.util.Enumeration enum =
    hphHome.findByHolidayProfileID(holidayProfileID);
    while (enum.hasMoreElements()) {
    Object obj = enum.nextElement();
    HolidayProfileHoliday bean =
    (HolidayProfileHoliday)javax.rmi.PortableRemoteObject.narrow(obj,
    HolidayProfileHoliday.class);
    alst.add(bean.getVO());
    } catch (FinderException e) {
    // throw as new ElmsCheckedException subclass
    throw new ElmsFinderException("getHolidayProfileHolidays(id):
    Could not find HolidayProfileHolidays.", e);
    } catch (RemoteException e) {
    // throw as new ElmsUncheckedException
    throw new ElmsUncheckedException(
    "getHolidayProfileHolidays()", e);
    } catch (RuntimeException e) {
    throw new ElmsUncheckedException(e);
    if (alst.size()>0) vos =
    (HolidayProfileHolidayVO[])alst.toArray(new HolidayProfileHolidayVO[1]);
    return vos;
    }

    Xiao,
    We have the same problem.
    The reason why your stand alone works, but your browser based doesn't,
    is because the iPlanet Application server requires that all EJBs, all
    objects held in any EJB, all objects held in attributes in an
    HttpSession, and all objects held in those objects MUST implement
    java.io.Serializable.
    The unfortunate reason why iPlanet does this is because iPlanet does not
    preserve the state of objects in memory across hits to the server.
    iPlanet serializes each and every object mentioned above when the HTML
    is returned to the client, and then un-serializes all the objects again
    when it receives another hit from the client. This is true even in the
    case of no-dsync sticky load balancing.
    This is ridiculous. We use sticky load balancing and we have many
    objects stored in HttpSession attributes which we do not want to be
    serialized every hit to the server, in the interest of speed. It takes
    too long to serialize all the objects, and it would take way too long to
    save them in a database every hit.
    David Shade
    xluo888 wrote:
    >
    I am running iplanet ias 6.0 sp3 with web server 6.0 sp1. I
    successfully deployed an ear file that contains the war and the jar to
    the APPS dir. The session ejbs and the entity ejbs are packed into the
    jar file which are deployed with the ear.
    I have two piece of testing code. One is a standalone java program.
    The other one is a jsp page together with the jsp bean which are packed
    into the war file in the ear. The jsp bean code and the standalone
    program are doing the same thing. They call a session ejb which calls an
    entity bean.
    I have made 2 experiments
    1> Start server, run the standalone test, got the correct result.
    Then run the jsp from the browser, got the correct result.
    2> Start server, run the jsp from the browser, fail to get the
    result. run the standalone test, fail to get the result
    The paten is very consistent. The code and the error msg for test 2 are
    attached. Could any one tell me what might cause the problem in the
    second test and how to resolve the it ?
    Thank in advance
    Xiao
    When the test fails, I got the following error msg from the console.
    [10/Nov/2001 12:08:08:3] info: --------------------------------------
    [10/Nov/2001 12:08:11:0] error: EBFP-serialize: error during
    serialization of me
    thod, exception = java.io.NotSerializableException: java.util.Vector$1
    java.io.NotSerializableException: java.util.Vector$1
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at
    java.io.ObjectOutputStream.outputArray(ObjectOutputStream.java:811)
    at
    java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(ObjectOut
    putStream.java:432)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:337)
    at
    java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:
    1567)
    at
    java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java
    :453)
    at
    java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
    at com.kivasoft.ebfp.FPSerializable.serialize(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    [10/Nov/2001 12:08:11:0] warning: EB-invalidate_delegate: instance
    com.plateausy
    [email protected] threw
    an unche
    cked or system exception, ex = ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    [10/Nov/2001 12:08:11:0] error: Exception Stack Trace:
    ElmsUncheckedException:
    getHolidayProfileHolidays()
    Nested stack traces:
    java.rmi.ServerException: RemoteException occurred in server thread;
    nested exce
    ption is:
    java.rmi.ConnectIOException: <mapped>
    java.rmi.ConnectIOException: <mapped>
    <<no stack trace available>>
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.HolidayProfileManagerBe
    an.getHolidayProfileHolidays(Unknown Source)
    at java.lang.reflect.Method.invoke(Native Method)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_skel_com_plateausys
    tems_elms_bo_holidayprofile_ejb_HolidayProfileManagerBean.getHolidayProfileHolid
    ays(ejb_skel_com_plateausystems_elms_bo_holidayprofile_ejb_HolidayProfileManager
    Bean.java:207)
    at
    com.plateausystems.elms.bo.holidayprofile.ejb.ejb_kcp_skel_HolidayPro
    fileManager.getHolidayProfileHolidays__seq_com_plateausystems_elms_bo_holidaypro
    __13918743(ejb_kcp_skel_HolidayProfileManager.java:326)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    ERROR [Thread-37] (?:?) - <HolidayProfileManagerJB:getHolidayVOs>Can't
    get Holid
    ayVOs by holiday profile id.java.rmi.ServerException: RemoteException
    occurred i
    n server thread; nested exception is:
    javax.transaction.TransactionRolledbackException
    *************************************************************end of
    error msg
    The attached is session and entity bean code segment.
    In the entity bean:
    public Enumeration ejbFindByHolidayProfileID(String id) {
    Vector list = new Vector();
    try {
    Connection connection = DBUtil.getConnection();
    try {
    PreparedStatement s =
    connection.prepareStatement(sqlFindByHolidayProfileID);
    try {
    s.setString(1, id);
    ResultSet rs = s.executeQuery();
    try {
    while (rs.next()) {
    HolidayProfileHolidayPK pk = new
    HolidayProfileHolidayPK();
    pk.holidayProfileID = rs.getString("hol_prfl_id");
    pk.holidayID = rs.getString("hol_id");
    list.add(pk);
    } finally {
    rs.close();
    } finally {
    s.close();
    } finally {
    connection.close();
    } catch (Exception e) {
    throw new EJBException(e);
    return list.elements();
    In the session bean:
    public HolidayProfileHolidayVO[] getHolidayProfileHolidays(String
    holidayProfileID) throws ElmsFinderException
    HolidayProfileHolidayVO[] vos = null;
    ArrayList alst = new ArrayList();
    HolidayProfileHolidayHome hphHome =
    this.getHolidayProfileHolidayHome();
    try {
    java.util.Enumeration enum =
    hphHome.findByHolidayProfileID(holidayProfileID);
    while (enum.hasMoreElements()) {
    Object obj = enum.nextElement();
    HolidayProfileHoliday bean =
    (HolidayProfileHoliday)javax.rmi.PortableRemoteObject.narrow(obj,
    HolidayProfileHoliday.class);
    alst.add(bean.getVO());
    } catch (FinderException e) {
    // throw as new ElmsCheckedException subclass
    throw new ElmsFinderException("getHolidayProfileHolidays(id):
    Could not find HolidayProfileHolidays.", e);
    } catch (RemoteException e) {
    // throw as new ElmsUncheckedException
    throw new ElmsUncheckedException(
    "getHolidayProfileHolidays()", e);
    } catch (RuntimeException e) {
    throw new ElmsUncheckedException(e);
    if (alst.size()>0) vos =
    (HolidayProfileHolidayVO[])alst.toArray(new HolidayProfileHolidayVO[1]);
    return vos;

  • Unable to read one-to-many relations using Hibernate

    Hi,
    I am trying with a very simple one-to-many relationship. When I am storing the objects, there are no problems. But when I am trying to read out the collection, it says invalid descriptor index. Please help.
    Regards,
    Hibernate version:
    hibernate-3.1rc2
    Mapping documents:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
         <class name="Parent">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <set name="children">
                   <key column="parent_id"/>
                   <one-to-many class="Child"/>
              </set>
         </class>
         <class name="Child">
              <id name="id">
                   <generator class="identity"/>
              </id>
              <property name="name"/>
         </class>
    </hibernate-mapping>
    Code between sessionFactory.openSession() and session.close():
    The Parent class:
    public class Parent
         private Long id ;     
         private Set children;
         Parent(){}
         public Long getId()
              return id;
         public void setId(Long id)
              this.id=id;
         public Set getChildren()
              return children;
         public void setChildren(Set children)
              this.children=children;
    The Child class:
    public class Child
         private Long id;
         private String name;
         Child(){}
         public Long getId()
              return id;
         private void setId(Long id)
              this.id=id;
         public String getName()
              return name;
         public void setName(String name)
              this.name=name;
    The Main class:
    public class PCManager
         public static void main(String[] args)
              PCManager mgr = new PCManager();
              List lt = null;
              if (args[0].equals("store"))
                   mgr.createAndStoreParent(new HashSet(3));
              else if (args[0].equals("list"))
                   mgr.listEvents();
              HibernateUtil.getSessionFactory().close();
         private void createAndStoreParent(HashSet s)
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent p1 = new Parent();
              int size = 3;
              for (int i=size; i>0; i--)
                   Child c = new Child();
                   c.setName("Child"+i);
                   s.add(c);
              p1.setChildren (s);
              Iterator elems = s.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   HibernateUtil.getSessionFactory().getCurrentSession().save(ch);
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().save(p1);
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
         private void listEvents()
              HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
              Parent result = (Parent) HibernateUtil.getSessionFactory().getCurrentSession().load(Parent.class, new Long(1));
              System.out.println("Id is :"+ result.getId());
              Set children = result.getChildren();
              Iterator elems = children.iterator();
              do {     
                   Child ch = (Child) elems.next();
                   System.out.println("Child Name"+ ch.getName());
              }while(elems.hasNext());
              HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();          
    Full stack trace of any exception that occurs:
    When I run with "hbm2ddl.auto" property as validate and trying to list the contents, I get the following out put.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Da
    ction=list
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:09:23,433 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:09:23,449 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:09:23,465 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:09:23,465 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:09:23,481 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:09:23,559 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:09:23,559 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:09:23,872 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:09:24,013 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:09:24,045 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:09:24,045 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:09:24,061 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,061 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,061 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:09:24,076 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,076 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,155 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:09:24,170 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:09:24,264 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:09:24,264 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:09:24,296 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:09:24,311 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:09:24,327 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:09:24,327 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:09:24,327 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:09:24,343 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:09:24,343 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:09:24,343 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:09:24,358 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:09:24,358 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:09:24,358 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:09:24,358 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:09:24,358 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:09:24,374 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:09:24,374 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:09:24,374 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:09:24,374 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:09:24,374 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:09:24,374 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:09:24,374 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:09:24,405 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:09:24,437 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:09:24,452 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:09:24,452 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:09:24,452 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:09:24,593 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:09:24,938 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:09:24,954 INFO SchemaValidator:99 - Running schema validator
    [java] 09:09:24,954 INFO SchemaValidator:107 - fetching database metadata
    [java] 09:09:24,954 INFO Configuration:1014 - processing extends queue
    [java] 09:09:24,954 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:09:24,954 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:09:24,954 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:09:24,985 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState
    : S1002
    [java] 09:09:24,985 ERROR JDBCExceptionReporter:72 - [Microsoft][ODBC SQL S
    erver Driver]Invalid Descriptor Index
    [java] 09:09:25,001 ERROR SchemaValidator:129 - Error closing connection
    [java] java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid transaction state
    [java] Initial SessionFactory creation failed.org.hibernate.exception.Gener
    icJDBCException: could not get table metadata: Child
    [java] java.lang.ExceptionInInitializerError
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] Caused by: org.hibernate.exception.GenericJDBCException: could not g
    et table metadata: Child
    [java] at org.hibernate.exception.SQLStateConverter.handledNonSpecificE
    xception(SQLStateConverter.java:91)
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLDisconnect(JdbcOdbc.java:2988)
    [java] at sun.jdbc.odbc.JdbcOdbcDriver.disconnect(JdbcOdbcDriver.java:9
    80)
    [java] at sun.jdbc.odbc.JdbcOdbcConnection.close(JdbcOdbcConnection.jav
    a:739)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:125)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] at HibernateUtil.<clinit>(Unknown Source)
    [java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateCon
    verter.java:79)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:43)
    [java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExcep
    tionHelper.java:29)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:100)
    [java] at org.hibernate.cfg.Configuration.validateSchema(Configuration.
    java:946)
    [java] at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaVal
    idator.java:116)
    [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryIm
    pl.java:299)
    [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
    tion.java:1145)
    [java] ... 3 more
    [java] Caused by: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver
    ]Invalid Descriptor Index
    [java] at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
    [java] at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
    [java] at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3862)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultS
    et.java:5561)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:338)
    [java] at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.j
    ava:395)
    [java] at PCManager.listEvents(Unknown Source)
    [java] at PCManager.main(Unknown Source)
    [java] at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata
    .java:30)
    [java] at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(
    DatabaseMetadata.java:85)
    [java] ... 7 more
    [java] Exception in thread "main"
    [java] Java Result: 1
    BUILD SUCCESSFUL
    Total time: 4 seconds
    Name and version of the database you are using:
    Microsoft SQLServer2000
    The generated SQL (show_sql=true):
    When the program is run with "hbm2ddl.auto" property as create, I get the following output.
    C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc2\MyHibernate>ant run -Daction=store
    Buildfile: build.xml
    clean:
    [delete] Deleting directory C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    [mkdir] Created dir: C:\Documents and Settings\mirza\Desktop\hibernate-3.1rc
    2\MyHibernate\bin
    copy-resources:
    [copy] Copying 4 files to C:\Documents and Settings\mirza\Desktop\hibernate
    -3.1rc2\MyHibernate\bin
    compile:
    [javac] Compiling 5 source files to C:\Documents and Settings\mirza\Desktop\
    hibernate-3.1rc2\MyHibernate\bin
    run:
    [java] 09:12:54,820 INFO Environment:474 - Hibernate 3.1 rc2
    [java] 09:12:54,836 INFO Environment:489 - loaded properties from resource
    hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate
    .cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.dial
    ect=org.hibernate.dialect.SQLServerDialect, hibernate.max_fetch_depth=1, hiberna
    te.jdbc.use_streams_for_binary=true, hibernate.format_sql=true, hibernate.query.
    substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.cac
    he.region_prefix=hibernate.test, hibernate.jdbc.batch_versioned_data=true, hiber
    nate.connection.pool_size=1}
    [java] 09:12:54,852 INFO Environment:519 - using java.io streams to persis
    t binary types
    [java] 09:12:54,852 INFO Environment:520 - using CGLIB reflection optimize
    r
    [java] 09:12:54,867 INFO Environment:550 - using JDK 1.4 java.sql.Timestam
    p handling
    [java] 09:12:54,946 INFO Configuration:1257 - configuring from resource: /
    hibernate.cfg.xml
    [java] 09:12:54,946 INFO Configuration:1234 - Configuration resource: /hib
    ernate.cfg.xml
    [java] 09:12:55,259 INFO Configuration:460 - Reading mappings from resourc
    e: PCMapping.hbm.xml
    [java] 09:12:55,400 INFO HbmBinder:266 - Mapping class: Parent -> Parent
    [java] 09:12:55,447 INFO HbmBinder:266 - Mapping class: Child -> Child
    [java] 09:12:55,447 INFO Configuration:1368 - Configured SessionFactory: n
    ull
    [java] 09:12:55,447 INFO Configuration:1014 - processing extends queue
    [java] 09:12:55,447 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:55,447 INFO HbmBinder:2233 - Mapping collection: Parent.child
    ren -> Child
    [java] 09:12:55,463 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:55,479 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:41 - Using Hibern
    ate built-in connection pool (not for production use!)
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:42 - Hibernate co
    nnection pool size: 1
    [java] 09:12:55,557 INFO DriverManagerConnectionProvider:45 - autocommit m
    ode: false
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:80 - using driver
    : sun.jdbc.odbc.JdbcOdbcDriver at URL: jdbc:odbc:MySQL
    [java] 09:12:55,573 INFO DriverManagerConnectionProvider:86 - connection p
    roperties: {}
    [java] 09:12:55,651 INFO SettingsFactory:77 - RDBMS: Microsoft SQL Server,
    version: 08.00.0194
    [java] 09:12:55,667 INFO SettingsFactory:78 - JDBC driver: JDBC-ODBC Bridg
    e (SQLSRV32.DLL), version: 2.0001 (03.85.1117)
    [java] 09:12:55,682 INFO Dialect:100 - Using dialect: org.hibernate.dialec
    t.SQLServerDialect
    [java] 09:12:55,698 INFO TransactionFactoryFactory:31 - Using default tran
    saction strategy (direct JDBC transactions)
    [java] 09:12:55,714 INFO TransactionManagerLookupFactory:33 - No Transacti
    onManagerLookup configured (in JTA environment, use of read-write or transaction
    al second-level cache is not recommended)
    [java] 09:12:55,714 INFO SettingsFactory:125 - Automatic flush during befo
    reCompletion(): disabled
    [java] 09:12:55,714 INFO SettingsFactory:129 - Automatic session close at
    end of transaction: disabled
    [java] 09:12:55,729 INFO SettingsFactory:144 - Scrollable result sets: ena
    bled
    [java] 09:12:55,729 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): d
    isabled
    [java] 09:12:55,745 INFO SettingsFactory:160 - Connection release mode: au
    to
    [java] 09:12:55,745 INFO SettingsFactory:184 - Maximum outer join fetch de
    pth: 1
    [java] 09:12:55,745 INFO SettingsFactory:187 - Default batch fetch size: 1
    [java] 09:12:55,745 INFO SettingsFactory:191 - Generate SQL with comments:
    disabled
    [java] 09:12:55,745 INFO SettingsFactory:195 - Order SQL updates by primar
    y key: disabled
    [java] 09:12:55,745 INFO SettingsFactory:338 - Query translator: org.hiber
    nate.hql.ast.ASTQueryTranslatorFactory
    [java] 09:12:55,777 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTran
    slatorFactory
    [java] 09:12:55,792 INFO SettingsFactory:203 - Query language substitution
    s: {no='N', yes='Y'}
    [java] 09:12:55,792 INFO SettingsFactory:209 - Second-level cache: enabled
    [java] 09:12:55,792 INFO SettingsFactory:213 - Query cache: disabled
    [java] 09:12:55,792 INFO SettingsFactory:325 - Cache provider: org.hiberna
    te.cache.HashtableCacheProvider
    [java] 09:12:55,808 INFO SettingsFactory:228 - Optimize cache for minimal
    puts: disabled
    [java] 09:12:55,808 INFO SettingsFactory:233 - Cache region prefix: hibern
    ate.test
    [java] 09:12:55,808 INFO SettingsFactory:237 - Structured second-level cac
    he entries: disabled
    [java] 09:12:55,839 INFO SettingsFactory:257 - Echoing all SQL to stdout
    [java] 09:12:55,839 INFO SettingsFactory:264 - Statistics: disabled
    [java] 09:12:55,839 INFO SettingsFactory:268 - Deleted entity synthetic id
    entifier rollback: disabled
    [java] 09:12:55,839 INFO SettingsFactory:283 - Default entity-mode: POJO
    [java] 09:12:55,980 INFO SessionFactoryImpl:155 - building session factory
    [java] 09:12:56,325 INFO SessionFactoryObjectFactory:82 - Not binding fact
    ory to JNDI, no JNDI name configured
    [java] 09:12:56,341 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,341 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,341 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,341 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,356 INFO Configuration:1014 - processing extends queue
    [java] 09:12:56,356 INFO Configuration:1018 - processing collection mappin
    gs
    [java] 09:12:56,356 INFO Configuration:1027 - processing association prope
    rty references
    [java] 09:12:56,372 INFO Configuration:1049 - processing foreign key const
    raints
    [java] 09:12:56,372 INFO SchemaExport:153 - Running hbm2ddl schema export
    [java] 09:12:56,388 DEBUG SchemaExport:171 - import file not found: /import
    .sql
    [java] 09:12:56,388 INFO SchemaExport:180 - exporting generated schema to
    database
    [java] 09:12:56,403 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] drop constraint FK3E104FC976A59A
    [java] 09:12:56,466 DEBUG SchemaExport:283 -
    [java] drop table Child
    [java] 09:12:56,544 DEBUG SchemaExport:283 -
    [java] drop table Parent
    [java] 09:12:56,654 DEBUG SchemaExport:283 -
    [java] create table Child (
    [java] id numeric(19,0) identity not null,
    [java] name varchar(255) null,
    [java] parent_id numeric(19,0) null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,779 DEBUG SchemaExport:283 -
    [java] create table Parent (
    [java] id numeric(19,0) identity not null,
    [java] primary key (id)
    [java] )
    [java] 09:12:56,873 DEBUG SchemaExport:283 -
    [java] alter table Child
    [java] add constraint FK3E104FC976A59A
    [java] foreign key (parent_id)
    [java] references Parent
    [java] 09:12:56,952 INFO SchemaExport:200 - schema export complete
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5701, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed database context to 'master'.
    [java] 09:12:56,952 WARN JDBCExceptionReporter:48 - SQL Warning: 5703, SQL
    State: 01000
    [java] 09:12:56,952 WARN JDBCExceptionReporter:49 - [Microsoft][ODBC SQL S
    erver Driver][SQL Server]Changed language setting to us_english.
    [java] 09:12:56,983 INFO SessionFactoryImpl:432 - Checking 0 named queries
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Child
    [java] (name)
    [java] values
    [java] (?) select
    [java] scope_identity()
    [java] Hibernate:
    [java] insert
    [java] into
    [java] Parent
    [java] default
    [java] values
    [java] select
    [java] scope_identity()
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] Hibernate:
    [java] update
    [java] Child
    [java] set
    [java] parent_id=?
    [java] where
    [java] id=?
    [java] 09:12:57,390 INFO SessionFactoryImpl:831 - closing
    [java] 09:12:57,390 INFO DriverManagerConnectionProvider:147 - cleaning up
    connection pool: jdbc:odbc:MySQL
    BUILD SUCCESSFUL
    Total time: 5 seconds
    Debug level Hibernate log excerpt:
    Included in the above description.

    That's not the right mapping for the 1:m relationship in Hibernate.
    First of all, I believe the recommendation is to have a separate .hbm.xml file for each class, so you should have one for Parent and Child.
    Second, you'll find the proper syntax for a one-to-many relationship here:
    http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html#tutorial-associations
    See if those help.
    The tutorial docs for Hibernate are quite good. I'd recommend going through them carefully.
    %

  • Java.io.NotSerializableException when using POF over Extend

    I changed a class to use POF and it seems to work fine among TCMP cluster members but when apps connect with Extend I get an exception indicating that maybe either the extend proxy or client app is not correctly configured to use POF.
    (Wrapped) java.io.NotSerializableException: dj_quotes.DJ_Quote
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:269)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:22)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
            at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
            at com.tangosol.coherence.component.net.extend.Channel.send(Channel.CDB:6)
            at com.tangosol.coherence.component.net.extend.Channel.receive(Channel.CDB:55)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer$DaemonPool$WrapperTask.run(Peer.CDB:9)
            at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
            at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
            at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: java.io.NotSerializableException: dj_quotes.DJ_Quote
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
            at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
            at com.tangosol.util.ExternalizableHelper.writeSerializable(ExternalizableHelper.java:2252)
            at com.tangosol.util.ExternalizableHelper.writeObjectInternal(ExternalizableHelper.java:2696)
            at com.tangosol.util.ExternalizableHelper.serializeInternal(ExternalizableHelper.java:2600)
            at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
            at com.tangosol.coherence.component.net.extend.proxy.serviceProxy.CacheServiceProxy$ConverterToBinary.convert(CacheServiceProxy.CDB:3)
            at com.tangosol.util.ConverterCollections$AbstractConverterEntry.getValue(ConverterCollections.java:3547)
            at com.tangosol.io.pof.PofBufferWriter.writeMap(PofBufferWriter.java:1977)
            at com.tangosol.coherence.component.net.extend.message.Response.writeExternal(Response.CDB:23)
            at com.tangosol.coherence.component.net.extend.message.response.PartialResponse.writeExternal(PartialResponse.CDB:1)
            at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor.encodeMessage(TcpAcceptor.CDB:8)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
            ... 9 moreLooks like it failed while attempting default serialization, right?
    My extend proxy servers start with
    -Dtangosol.coherence.cacheconfig=cache-config-extend-proxy.xml
    here:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <!-- ***********  SCHEME MAPPINGS  ***********  -->
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>quotes.*</cache-name>
                   <scheme-name>quotes-scheme</scheme-name>
              </cache-mapping>   
         </caching-scheme-mapping>
         <!-- ******************************** -->
         <caching-schemes>
              <proxy-scheme>
          <service-name>ExtendTcpProxyService</service-name>
          <thread-count>8</thread-count>
          <acceptor-config>
            <tcp-acceptor>
              <local-address>
                <address system-property="tangosol.coherence.proxy.address">localhost</address>
                <port system-property="tangosol.coherence.proxy.port">9090</port>
              </local-address>
            </tcp-acceptor>
          </acceptor-config>
          <proxy-config>
                  <cache-service-proxy>
                    <lock-enabled>true</lock-enabled>
                  </cache-service-proxy>
                </proxy-config>
          <autostart>true</autostart>
        </proxy-scheme>
              <distributed-scheme>
                   <scheme-name>quotes-scheme</scheme-name>
                   <service-name>DistributedQuotesCacheService</service-name>
                   <serializer>
                        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                        <init-params>
              <init-param>
                <param-type>string</param-type>
                <param-value system-property="pof.config">z:/coherence/pof-config.xml</param-value>
              </init-param>
            </init-params>
                   </serializer>
                   <backing-map-scheme>
                        <local-scheme/>
                   </backing-map-scheme>
                   <autostart>true</autostart>
              </distributed-scheme>
    </caching-schemes>
    </cache-config>extend client apps start with
    -Dtangosol.coherence.cacheconfig=z:/coherence/cache-config-extend-client.xml
    here:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <!-- ***********  SCHEME MAPPINGS  ***********  -->
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>quotes.*</cache-name>
                   <scheme-name>extend-scheme</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <!-- ******************************** -->
         <caching-schemes>
              <remote-cache-scheme>
                    <scheme-name>extend-scheme</scheme-name>
                    <service-name>ExtendTcpCacheService</service-name>
                    <initiator-config>
                    <tcp-initiator>
              <remote-addresses>
                 <socket-address>
                  <address>192.168.3.6</address>
                  <port>9090</port>
                </socket-address>
              </remote-addresses>
              <connect-timeout>12s</connect-timeout>
            </tcp-initiator>
            <outgoing-message-handler>
              <request-timeout>6s</request-timeout>
            </outgoing-message-handler>
          </initiator-config>
        </remote-cache-scheme>
              <!-- ALSO TRIED THIS IN PLACE OF extend-scheme -->
                    <remote-cache-scheme>
          <scheme-name>extend-scheme-pof</scheme-name>
          <service-name>ExtendPofTcpCacheService</service-name>
                   <serializer>
                        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
                        <init-params>
              <init-param>
                <param-type>string</param-type>
                <param-value system-property="pof.config">z:/coherence/pof-config.xml</param-value>
              </init-param>
            </init-params>
                   </serializer>
          <initiator-config>
            <tcp-initiator>
              <remote-addresses>
                <!-- mothra -->
                 <socket-address>
                  <address>192.168.3.6</address>
                  <port>9090</port>
                </socket-address>
              </remote-addresses>
              <connect-timeout>12s</connect-timeout>
            </tcp-initiator>
            <outgoing-message-handler>
              <request-timeout>6s</request-timeout>
            </outgoing-message-handler>
          </initiator-config>
        </remote-cache-scheme>
    </caching-schemes>
    </cache-config>pof-config.xml should be fine...
    <!DOCTYPE pof-config SYSTEM "pof-config.dtd">
    <pof-config>
      <user-type-list>
        <include>coherence-pof-config.xml</include>
        <user-type>
          <type-id>10001</type-id>
          <class-name>dj_quotes.DJ_Quote</class-name>
        </user-type>
      </user-type-list>
    </pof-config>Any ideas what I missed?
    Thanks,
    Andrew

    Looks like I spoke too soon. Moving the <serializer> to the correct location in the Extend client XML config did fix the problem I was seeing but it created a new problem. It appears the Extend client wants to use POF for everything including non-POF services like the one handling the Serializable (non-POF) object oms.Order. That's what I gather from this exception
    Exception in thread "AWT-EventQueue-0" (Wrapped) java.io.IOException: unknown user type: oms.Order
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)
            at com.tangosol.util.Base.ensureRuntimeException(Base.java:269)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:22)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
            at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
            at com.tangosol.coherence.component.net.extend.Channel.request(Channel.CDB:18)
            at com.tangosol.coherence.component.net.extend.Channel.request(Channel.CDB:1)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache$BinaryCache.putAll(RemoteNamedCache.CDB:10)
            at com.tangosol.util.ConverterCollections$ConverterMap.putAll(ConverterCollections.java:1702)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache.putAll(RemoteNamedCache.CDB:1)
            at com.tangosol.coherence.component.util.SafeNamedCache.putAll(SafeNamedCache.CDB:1)
            at oms.Order.sendMultiple(Order.java:357)
            at order_entry_window.OrderEntryPanel$SubmitListener.sendOrder(OrderEntryPanel.java:1307)
            at order_entry_window.OrderEntryPanel$SubmitListener.actionPerformed(OrderEntryPanel.java:1321)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
            at java.awt.Component.processMouseEvent(Component.java:6504)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
            at java.awt.Component.processEvent(Component.java:6269)
            at java.awt.Container.processEvent(Container.java:2229)
            at java.awt.Component.dispatchEventImpl(Component.java:4860)
            at java.awt.Container.dispatchEventImpl(Container.java:2287)
            at java.awt.Component.dispatchEvent(Component.java:4686)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
            at java.awt.Container.dispatchEventImpl(Container.java:2273)
            at java.awt.Window.dispatchEventImpl(Window.java:2713)
            at java.awt.Component.dispatchEvent(Component.java:4686)
            at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
            at java.awt.EventQueue.access$000(EventQueue.java:101)
            at java.awt.EventQueue$3.run(EventQueue.java:666)
            at java.awt.EventQueue$3.run(EventQueue.java:664)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
            at java.awt.EventQueue$4.run(EventQueue.java:680)
            at java.awt.EventQueue$4.run(EventQueue.java:678)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.io.IOException: unknown user type: oms.Order
            at com.tangosol.io.pof.ConfigurablePofContext.serialize(ConfigurablePofContext.java:341)
            at com.tangosol.util.ExternalizableHelper.serializeInternal(ExternalizableHelper.java:2596)
            at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
            at com.tangosol.coherence.component.net.extend.RemoteNamedCache$ConverterToBinary.convert(RemoteNamedCache.CDB:4)
            at com.tangosol.util.ConverterCollections$AbstractConverterEntry.getValue(ConverterCollections.java:3547)
            at com.tangosol.io.pof.PofBufferWriter.writeMap(PofBufferWriter.java:1977)
            at com.tangosol.coherence.component.net.extend.messageFactory.NamedCacheFactory$PutAllRequest.writeExternal(NamedCacheFactory.CDB:3)
            at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
            at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
            ... 47 more
    Caused by: java.lang.IllegalArgumentException: unknown user type: oms.Order
            at com.tangosol.io.pof.ConfigurablePofContext.getUserTypeIdentifier(ConfigurablePofContext.java:420)
            at com.tangosol.io.pof.ConfigurablePofContext.getUserTypeIdentifier(ConfigurablePofContext.java:409)
            at com.tangosol.io.pof.PofBufferWriter.writeUserType(PofBufferWriter.java:1660)
            at com.tangosol.io.pof.PofBufferWriter.writeObject(PofBufferWriter.java:1622)
            at com.tangosol.io.pof.ConfigurablePofContext.serialize(ConfigurablePofContext.java:335)
            ... 56 moreSo I posted a follow-up question here:
    Can an extend client use both POF and java.io.Serializable?
    Thanks,
    Andrew

  • Weblogic-cmp-rdbms-jar.xml for One-To-Many unidirectional relationship

    hi,
    I am trying to create a simple cmp One-To-Many unidirectional relationship and deploy the same in weblogic. Can someone help me with the weblogic-cmp-rdbms-jar.xml. Am attaching the weblogic-cmp-rdbms-jar. xml tht i am using as also the corresponding ejb-jar.xml. Pls. note tht i want a unidirectional relationship here. one i am tryng However i get this error:
    Error while reading 'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was: Role 'Supplier supplies Products' of relationship 'Product Supplier' contains an invalid key-column value of 'productID'. The key-column must specify a primary key column in the related bean. However, there is no primary key column named 'productID' defined in the related bean 'ProductEJB' or else 'productID' is not being recognized due to case mismatch. My weblogic-cmp-rdbms-jar
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms-jar.dtd'>
    <weblogic-rdbms-jar>
    <weblogic-rdbms-bean>
         <ejb-name>SupplierEJB</ejb-name>
         <data-source-name>RJDataSource</data-source-name>
         <table-map>
               <table-name>AA_Supplier</table-name>
               <field-map>
                     <cmp-field>supplierID</cmp-field>
                     <dbms-column>supplierID</dbms-column>
               </field-map>
               <field-map>
                    <cmp-field>name</cmp-field>
                    <dbms-column>name</dbms-column>
               </field-map>
         </table-map>
    </weblogic-rdbms-bean>
    <weblogic-rdbms-bean>
           <ejb-name>ProductEJB</ejb-name>
           <data-source-name>RJDataSource</data-source-name>
           <table-map>
                 <table-name>AA_Product</table-name>
                 <field-map>
                      <cmp-field>productID</cmp-field>
                      <dbms-column>productid</dbms-column>
                 </field-map>
                 <field-map>
                      <cmp-field>description</cmp-field>
                      <dbms-column>description</dbms-column>
                 </field-map>
                 <field-map>
                      <cmp-field>basePrice</cmp-field>
                      <dbms-column>baseprice</dbms-column>
                 </field-map>
                <field-map>
                      <cmp-field>name</cmp-field>
                      <dbms-column>name</dbms-column>
                 </field-map>
                 <field-map>
                     <cmp-field>supplierID</cmp-field>
                       <dbms-column>supplierID</dbms-column>
                 </field-map>
            </table-map>
    </weblogic-rdbms-bean>
    <weblogic-rdbms-relation>
         <relation-name>Product Supplier</relation-name>
         <weblogic-relationship-role>
              <relationship-role-name>Supplier supplies Products</relationship-role-name>
              <relationship-role-map>
                   <column-map>
                        <foreign-key-column>supplierID</foreign-key-column>
                        <key-column>productID</key-column>
                   </column-map>
              </relationship-role-map>
         </weblogic-relationship-role>
         <weblogic-relationship-role>
              <relationship-role-name>Product supplied by Supplier</relationship-role-name>
              <relationship-role-map>
              <column-map>
                   <foreign-key-column>products</foreign-key-column>
                   <key-column>supplierID</key-column>
              </column-map>
              </relationship-role-map>
         </weblogic-relationship-role>
    </weblogic-rdbms-relation>
    </weblogic-rdbms-jar> My ejb-jar.xml
    <?xml version="1.0"?>
    <!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>
         <entity>
              <ejb-name>SupplierEJB</ejb-name>
              <home>com.tpt.practice.entityBeans.cmp.product.relationship.SupplierHome</home>
              <remote>com.tpt.practice.entityBeans.cmp.product.relationship.Supplier</remote>
              <ejb-class>com.tpt.practice.entityBeans.cmp.product.relationship.SupplierEJB</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>java.lang.String</prim-key-class>
              <reentrant>False</reentrant>
              <cmp-version>2.x</cmp-version>
              <abstract-schema-name>AA_Supplier</abstract-schema-name>
              <cmp-field>
                   <field-name>supplierID</field-name>
              </cmp-field>
              <cmp-field>
                   <field-name>name</field-name>
              </cmp-field>
              <primkey-field>supplierID</primkey-field>
              <ejb-ref>
                        <ejb-ref-name>ProducEJB</ejb-ref-name>
                        <ejb-ref-type>Entity</ejb-ref-type>
                        <home>com.tpt.practice.entityBeans.cmp.product.ProductHome</home>
                        <remote>com.tpt.practice.entityBeans.cmp.product.Product</remote>
                        <ejb-link>ProductEJB#ProductEJB.jar</ejb-link>
              </ejb-ref>
              <query>
                   <query-method>
                        <method-name>findByName</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Supplier AS a WHERE a.name =
                        ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findAllSuppliers</method-name>
                        <method-params>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Supplier AS a WHERE a.supplierID
                        IS NOT NULL]]>
                   </ejb-ql>
              </query>
         </entity>
         <entity>
              <ejb-name>ProductEJB</ejb-name>
              <home>com.tpt.practice.entityBeans.cmp.product.relationship.ProductHome</home>
              <remote>com.tpt.practice.entityBeans.cmp.product.relationship.Product</remote>
              <local-home>com.tpt.practice.entityBeans.cmp.product.relationship.ProductLocalHome</local-home>
              <local>com.tpt.practice.entityBeans.cmp.product.relationship.ProductLocal</local>
              <ejb-class>com.tpt.practice.entityBeans.cmp.product.relationship.ProductEJB</ejb-class>
              <persistence-type>Container</persistence-type>
              <prim-key-class>com.tpt.practice.entityBeans.cmp.product.relationship.ProductPK</prim-key-class>
              <reentrant>False</reentrant>
              <cmp-version>2.x</cmp-version>
              <abstract-schema-name>AA_Product</abstract-schema-name>
              <cmp-field>
                   <field-name>productID</field-name>
              </cmp-field>
              <cmp-field>
                   <field-name>name</field-name>
              </cmp-field>
              <cmp-field>
                   <field-name>description</field-name>
              </cmp-field>
              <cmp-field>
                   <field-name>basePrice</field-name>
              </cmp-field>
              <cmp-field>
                   <field-name>supplierID</field-name>
              </cmp-field>
              <primkey-field>productID</primkey-field>
              <query>
                   <query-method>
                        <method-name>findByName</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.name =
                        ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findByDescription</method-name>
                        <method-params>
                             <method-param>java.lang.String</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.description
                        = ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findByBasePrice</method-name>
                        <method-params>
                             <method-param>double</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice =
                        ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findExpensiveProducts</method-name>
                        <method-params>
                             <method-param>double</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice >
                        ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findCheapProducts</method-name>
                        <method-params>
                             <method-param>double</method-param>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.basePrice <
                        ?1]]>
                   </ejb-ql>
              </query>
              <query>
                   <query-method>
                        <method-name>findAllProducts</method-name>
                        <method-params>
                        </method-params>
                   </query-method>
                   <ejb-ql>
                        <![CDATA[SELECT OBJECT(a) FROM AA_Product AS a WHERE a.productID
                        IS NOT NULL]]>
                   </ejb-ql>
              </query>
         </entity>
         </enterprise-beans>
         <relationships>
         <ejb-relation>
              <ejb-relation-name>Product Supplier</ejb-relation-name>
              <ejb-relationship-role>
                   <ejb-relationship-role-name>Supplier supplies Products</ejb-relationship-role-name>
                   <multiplicity>One</multiplicity>
                   <relationship-role-source>
                        <ejb-name>SupplierEJB</ejb-name>
                   </relationship-role-source>
                   <cmr-field>
                        <cmr-field-name>products</cmr-field-name>
                        <cmr-field-type>java.util.Collection</cmr-field-type>
                   </cmr-field>
              </ejb-relationship-role>
              <ejb-relationship-role>
                   <ejb-relationship-role-name>Product supplied by Supplier</ejb-relationship-role-name>
                   <multiplicity>Many</multiplicity>
                   <relationship-role-source>
                        <ejb-name>ProductEJB</ejb-name>
                   </relationship-role-source>
              </ejb-relationship-role>
         </ejb-relation>
         </relationships>
         <assembly-descriptor>
              <container-transaction>
              <method>
                   <ejb-name>SupplierEJB</ejb-name>
                   <method-intf>Remote</method-intf>
                   <method-name>*</method-name>
              </method>
              <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>

    I think u r some confusion with productID and SuppliedID . primary key of one column( productId ) can be a foreign key of other table colum( SuppliedID). but foreign key( SuppliedID) can not be a primary key of second table .u declared SuppliedId as primary key . so ur mapping is incorrect.

  • Getting java.io.NotSerializableException: sun.management.MemoryPoolImpl

    Hi,
    While trying to get JVM Memory pool information of a remote computer ,am getting java.io.NotSerializableException. I used following method
    ManagementFactory.getMemoryPollMXBean().
    Please help me to solve these exception.
    java.io.NotSerializableException: sun.management.MemoryPoolImpl
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
    at java.util.ArrayList.writeObject(ArrayList.java:570)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
    at com.path.systemmanager.tunnelGate.TunnelServlet.doPost(TunnelServlet.java:38)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    Thanks,
    Sreejith

    I agree, it looks frustrating. Obviously the serialization process has found the non-serializable object during the traversal of the object graph, but its difficult to know where this is.
    Your class looks a bit "serialization-heavy", if you don't mind me saying. I avoid serializing anything to do with swing components and stick to collections and my own classes. Do you need to serialize these? If not, mark them transient. You can do this for all of them and then reintroduce into the serialized form one at a time to see which one causes the problem (just for curiosity).
    When the object is deserialized you will have to make the necessary arrangements to set up any members that you marked transient, as these will be null. You can do this is readObject, but on this subject, why are you writing out the points member explicitly? It will be written out anyway since there is nothing special about it.
    I don't know how familiar you are with the serialization package but its a sharp instrument that needs respect. I would advise reading the specification, if you haven't already done so.

  • One to many mappings and combination generation

    Please help folks,
    I want to perform one to many mapping i.e a single row of data will be taken from a single table Table 'A' into Hashtable A and it has to be matched with 'n' number of rows from another table Table 'B' taken into Hashtable B. The no. of rows selected from B can be 1/2.... upto n. For performing this mapping iam using a Combination Generator Code which will Key nos. to be selected for checking whether they can be mapped and then further processing is done on these key nos. returned by the combination generator. The code for combination generator is given below.
    The issue is say if there are about 50 rows in table B then no of combinations possible are 2 ^ 50, which is just too much for the PC to handle i.e the code takes about 4-5 days of processing time. 256 MB RAM, P4. The mapping has to be done in 30 minutes!!!! Ne ideas folks????
    // Systematically generate combinations.
    import java.math.BigInteger;
    public class CombinationGenerator {
    private int[] a;
    private int n;
    private int r;
    private BigInteger numLeft;
    private BigInteger total;
    // Constructor
    public static void main(String[] args)
    String[] elements = {"a", "b", "c", "d", "e", "f", "g"};
    int[] indices;
    CombinationGenerator x = new CombinationGenerator (elements.length, 3);
    StringBuffer combination;
    while (x.hasMore ()) {
    combination = new StringBuffer ();
    indices = x.getNext ();
    for (int i = 0; i < indices.length; i++) {
    combination.append (elements[indices[i]]);
    System.out.println (combination.toString ());
    public CombinationGenerator (int n, int r) {
    if (r > n) {
    throw new IllegalArgumentException ();
    if (n < 1) {
    throw new IllegalArgumentException ();
    this.n = n;
    this.r = r;
    a = new int[r];
    BigInteger nFact = getFactorial (n);
    BigInteger rFact = getFactorial (r);
    BigInteger nminusrFact = getFactorial (n - r);
    total = nFact.divide (rFact.multiply (nminusrFact));
    reset ();
    // Reset
    public void reset () {
    for (int i = 0; i < a.length; i++) {
    a[i] = i;
    numLeft = new BigInteger (total.toString ());
    // Return number of combinations not yet generated
    public BigInteger getNumLeft () {
    return numLeft;
    // Are there more combinations?
    public boolean hasMore () {
    return numLeft.compareTo (BigInteger.ZERO) == 1;
    // Return total number of combinations
    public BigInteger getTotal () {
    return total;
    // Compute factorial
    private static BigInteger getFactorial (int n) {
    BigInteger fact = BigInteger.ONE;
    for (int i = n; i > 1; i--) {
    fact = fact.multiply (new BigInteger (Integer.toString (i)));
    return fact;
    // Generate next combination (algorithm from Rosen p. 286)
    public int[] getNext () {
    if (numLeft.equals (total)) {
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    int i = r - 1;
    while (a[i] == n - r + i) {
    i--;
    System.out.println("inside while");
    a[i] = a[i] + 1;
    for (int j = i + 1; j < r; j++) {
    a[j] = a[i] + j - i;
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;

    Next time you post, see the formatting guidelines [url http://forum.java.sun.com/features.jsp#Formatting]here. //--------------------------------------
    // Systematically generate combinations.
    import java.math.BigInteger;
    public class CombinationGenerator {
    private int[] a;
    private int n;
    private int r;
    private BigInteger numLeft;
    private BigInteger total;
    // Constructor
    public static void main(String[] args)
    String[] elements = {"a", "b", "c", "d", "e", "f", "g"};
    int[] indices;
    CombinationGenerator x = new CombinationGenerator (elements.length, 3);
    StringBuffer combination;
    while (x.hasMore ()) {
    combination = new StringBuffer ();
    indices = x.getNext ();
    for (int i = 0; i < indices.length; i++) {
    combination.append (elements[indices]);
    System.out.println (combination.toString ());
    public CombinationGenerator (int n, int r) {
    if (r > n) {
    throw new IllegalArgumentException ();
    if (n < 1) {
    throw new IllegalArgumentException ();
    this.n = n;
    this.r = r;
    a = new int[r];
    BigInteger nFact = getFactorial (n);
    BigInteger rFact = getFactorial (r);
    BigInteger nminusrFact = getFactorial (n - r);
    total = nFact.divide (rFact.multiply (nminusrFact));
    reset ();
    // Reset
    public void reset () {
    for (int i = 0; i < a.length; i++) {
    a = i;
    numLeft = new BigInteger (total.toString ());
    // Return number of combinations not yet generated
    public BigInteger getNumLeft () {
    return numLeft;
    // Are there more combinations?
    public boolean hasMore () {
    return numLeft.compareTo (BigInteger.ZERO) == 1;
    // Return total number of combinations
    public BigInteger getTotal () {
    return total;
    // Compute factorial
    private static BigInteger getFactorial (int n) {
    BigInteger fact = BigInteger.ONE;
    for (int i = n; i > 1; i--) {
    fact = fact.multiply (new BigInteger (Integer.toString (i)));
    return fact;
    // Generate next combination (algorithm from Rosen p. 286)
    public int[] getNext () {
    if (numLeft.equals (total)) {
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    int i = r - 1;
    while (a == n - r + i) {
    i--;
    System.out.println("inside while");
    a = a + 1;
    for (int j = i + 1; j < r; j++) {
    a[j] = a + j - i;
    numLeft = numLeft.subtract (BigInteger.ONE);
    return a;
    }

Maybe you are looking for

  • How to run the same license on two computers?

    Hello, I have searched around a bit for answers to my questions without luck so far. I have used Adobe Lightroom 3 & 4 on my computer for years. Now I have purchased a laptop computer as well. I am the only user of both computers. As I understand the

  • HT204053 the wrong cell phone number shows up on my ipad

    The wrong cell phone number shows up on my ipad when I put in my apple id. I have got to my apple.com and changed my phone number and it still won't change. I have even reset my iPad to correct it and didn't work. UGH! Help!

  • Method access problem

    I am creating a jsp web page to display the items to add to a shopping cart I am getting the following error message error message when i try to run may jsp display page i dont know what I have to do to get this working I am running Tomcat 5, Any hel

  • Cannot install OS X 10.6.2 Update or Hewlett-Packard Printer Drivers

    Error message #1: "Mac OS X Update can't be installed on this disk. This volume does not meet the requirements for this update." Error message #2 (regarding Printer Drivers): This volume does not meet the requirements for this update. Disk in questio

  • Applications suddenly closing

    When I click "Save As" in applications such as Dreamweaver and Photoshop the application closes and I get a "[Application Name] Quit Unexpectedly" notice. This is very frustrating as I can't edit photos, or use a previous web page as a quick template