Deserializing complex beans

I am trying to retrieve a Data object, which has a List of Var objects and a List of Case objects. When I retrieve it it shows the Data object, but the two Lists are null.
I think it is a client side problem, so I will start with my client side code first.
The AS objects are generated from the java objects by Maven Flexmojos plugin and looks as follow
package com.example.module.statistics.model {
    [Bindable]
    [RemoteClass(alias="com.example.module.statistics.model.Data")]
    public class Data extends DataBase {
package com.example.module.statistics.model {
    import flash.utils.IDataInput;
    import flash.utils.IDataOutput;
    import flash.utils.IExternalizable;
    import mx.collections.ListCollectionView;
    [Bindable]
    public class DataBase implements IExternalizable {
            private var _cases:ListCollectionView;
            private var _vars:ListCollectionView;
    public function DataBase()
        super();
        public function get cases():ListCollectionView {
            return _cases;
        public function get vars():ListCollectionView {
            return _vars;
        public function readExternal(input:IDataInput):void {
            _cases = input.readObject() as ListCollectionView;
            _vars = input.readObject() as ListCollectionView;
        public function writeExternal(output:IDataOutput):void {
            output.writeObject(_cases);
            output.writeObject(_vars);
And Var:
package com.example.module.statistics.model {
    [Bindable]
    [RemoteClass(alias="com.example.module.statistics.model.Var")]
    public class Var extends VarBase {
package com.example.module.statistics.model {
    import flash.utils.IDataInput;
    import flash.utils.IDataOutput;
    import flash.utils.IExternalizable;
    [Bindable]
    public class VarBase implements IExternalizable {
            private var _keep:Boolean;
            private var _name:String;
            private var _type:String;
    public function VarBase()
        super();
        public function set keep(value:Boolean):void {
            _keep = value;
        public function get name():String {
            return _name;
        public function set name(value:String):void {
            _name = value;
        public function get type():String {
            return _type;
        public function set type(value:String):void {
            _type = value;
        public function readExternal(input:IDataInput):void {
            _keep = input.readObject() as Boolean;
            _name = input.readObject() as String;
            _type = input.readObject() as String;
        public function writeExternal(output:IDataOutput):void {
            output.writeObject(_keep);
            output.writeObject(_name);
            output.writeObject(_type);
I omitted Case, it looks like Var.
Then I have a Facade in AS which calls the service at the server side:
package com.example.statistics.facade {
    import mx.rpc.AsyncToken;
    import mx.rpc.events.ResultEvent;
    import flash.utils.ByteArray;
    import com.example.flexmodules.remoteservice.RemoteService;
    import com.example.module.statistics.model.Data;
    public class StatisticsFacade extends RemoteService {
        public function StatisticsFacade() {
            super("flexStatisticsFacadeImpl", "secureStatisticschannel", "http://localhost:8081/statistics-webapp-4.0.0-SNAPSHOT/messagebroker/securestatisticschann el", false);
        public function convertData(filename : String, data : ByteArray, callback : Function) : void {
            var token : AsyncToken = remoteObject.convertData(filename, data);
            var listener : Function = function(event : ResultEvent) : void {
                if (event.token == token) {
                    remoteObject.removeEventListener(ResultEvent.RESULT, listener);
                    callback(event.result as Data);
            remoteObject.addEventListener(ResultEvent.RESULT, listener);
And a RemoteService with some basic code:
package com.example.flexmodules.remoteservice {
    import mx.core.Application;
    import mx.messaging.Channel;
    import mx.messaging.ChannelSet;
    import mx.messaging.channels.AMFChannel;
    import mx.messaging.channels.SecureAMFChannel;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.remoting.mxml.RemoteObject;
    import com.example.flexmodules.remoteservice.events.RemoteExceptionEvent;
    public class RemoteService {
        protected var remoteObject : RemoteObject;
         * Constructor for the actual RemoteObject to create. An event listener
         * is added for exceptions.
         * @param id String representing the id of the new RemoteObject to create
         * @param channelname String representing the channelname of the new RemoteObject to create
         * @param destination String representing the destination of the RemoteObject to create
         * @param secure Boolean representing whether or not the RemoteObject should setup a secure channel
        public function RemoteService(id : String, channelname : String, destination : String, secure : Boolean) {
            remoteObject = new RemoteObject(id);
            remoteObject.showBusyCursor = true;
            remoteObject.channelSet = new ChannelSet();
            var channel : Channel;
            if (secure) {
                channel = new SecureAMFChannel(channelname, destination);
            } else {
                channel = new AMFChannel(channelname, destination);
            remoteObject.channelSet.addChannel(channel);
            remoteObject.addEventListener(FaultEvent.FAULT, onRemoteException);
         * Generic fault event handler for all remote object actions. Based on the received message an action
         * is taken, mostly throwing a new event.
         * @param event FaultEvent received for handling
        public function onRemoteException(event : FaultEvent) : void {
            trace('code : ' + event.fault.faultCode + ', message : ' + event.fault.faultString + ',detail : ' + event.fault.faultDetail);
            Application.application.dispatchEvent(new RemoteExceptionEvent(RemoteExceptionEvent.REMOTE_EXCEPTION, "Unknown problem occurred during a remote call : " + event.fault.message));
When I run this, I see at the server side that the Var list has a few items in it. When I look at the client side the vars list is null.
Do I just have the complete wrong way of doing this, or am I missing something about deserialization?

Can you share your WSDL and config-wsdl.xml ?
What version of JWSDP are you using ?
Post your JAX-RPC related questions to [email protected] for a quicker resolution.
Send an email to [email protected] to subscribe to the alias.
Send an mail to [email protected] for a complete list of help commands.
-Arun

Similar Messages

  • Problem when importing the complex bean model into webdynpro

    hi all,
    when importing the complex bean model into the webDynpro, it was returning the blank.
    Thanks in advance

    Hi,
      show your code for see and understand what could be wrong.
    Here one mine example:
    The model class
    * Created on 27-ott-2006
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package tmp.userslist.comp.model.userslist;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import javax.sql.DataSource;
    import java.util.Collection;
    import java.util.ArrayList;
    import java.io.Serializable;
    * @author rtagliento
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    public class AllUsers {
    // implements Serializable {
         private Connection con;
         private ResultSet rs;
         private Statement stmt;
         private String SqlQuery;
         private Collection usersList = null;
         private UserElement users = null;
    //     private Collection empDetailsList=null;
    //     private EmpDetailsHelperClass  empdetails=null;
         public AllUsers(){
              con = null;     
              java.sql.ResultSet rs = null;
              rs = null;
              SqlQuery  = "SELECT * FROM TMP_USERSLIST ; ";
         public Connection getConnection (){
                   return con;
         public void setConnection (Connection c){
              con = c;
         public Collection getUsersList()
              return usersList;
         public UserElement getUsers()
              return users;
         public void setUsers(UserElement class1)
              users = class1;
         public void execute() throws Exception {
              String DEBUG = new String("");
              try {
                   stmt = con.createStatement();
                   rs = stmt.executeQuery(SqlQuery);
                   usersList = new ArrayList();
                   usersList.clear();
                   while (rs.next()){
                        users = new UserElement();
                        users.setID(rs.getString("ID"));
                        DEBUG += "ID: " + rs.getString("ID") + " | ";
                        users.setName(rs.getString("NAME"));
                        DEBUG += "NAME: " + rs.getString("NAME") + " | ";
                        users.setSurname(rs.getString("SURNAME"));
                        DEBUG += "SURNAME: " + rs.getString("SURNAME") + " | ";
                        users.setBirthDay(rs.getDate("BIRTHDAY"));
                        DEBUG += "BIRTHDAY: " + rs.getDate("BIRTHDAY").toString() + " ---------- ";
                        usersList.add(users);
                   rs.close();
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   throw new Exception(e.toString() + DEBUG);
    //          throw new Exception(new Integer(usersList.size()).toString() + DEBUG);
    when use it:
         AllUsers AllU = new AllUsers();
    //     AllU.setConnection(myJdbc.getConnection());
         wdContext.nodeAllUsers().bind(AllU);
         wdContext.currentAllUsersElement().setConnection(myJdbc.getConnection());
         try {
              wdContext.currentAllUsersElement().modelObject().execute();
         } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    Hope can help.
    Bye

  • Dealing with complex beans

    Hi there!
    I'm developing an app in NetBeans that has a 'complex' object/backing bean structure. For example a CalculationBean has an ArrayList of ProductBeans.
    How can I make it so that the user tells how many Products he wants in the Calculation, after that the application creates the Beans, and shows the productForm bound to them? ( Also, is it possible to show the productForm-s on the same page, created dynamically? )
    Any help will be appreciated!
    Daniel

    I would also suggest Tomahawk's dataList component, if dataTable is not to your liking.

  • Java.io.NotSerializableException: sun.awt.image.BufferedImageGraphics2D

    Hi all!
    This problem is in relation to a very complex bean for data visualization which is jarred and bridged as an activex control.
    I am able to create the activex control and embed it in a vb form. But when I try to run the application in vb I get the following message and the application does not start.
    java.io.NotSerializableException: sun.awt.image.BufferedImageGraphics2D The bean has not used the class mentioned above anywhere. It uses the
    Image
    class though. I have used other beans, which use the same drawing techniques as the bean in question, as activex controls, with no errors.
    What could be the problem?
    tia
    Shailesh
    PS: the actual error dump is 1 page long I can send it by email on request.

    Hello,
    Have you implemented the Serializable Interface? I usually receive that error when I forgot to implement that interface. It is mandatory for a JavaBean to implement this interface.
    As an example:
    import java.io.Serializable;
    public class SimpleBean implements Serializable
    I hope it helps.
    Antonio Castro

  • Complex "validation rule" using Java Bean code

    Hi,
    I have never used validation rules with jdeveloper, but i need a complex validation rule of one column of my table.
    Can i put a "validation rule" on an attibute of a view object, or on a column of a table, that use Bean code ?
    My column must contain different values depending of the other columns of the table, so i think i can't do this without java code...
    I tried to doubleClick on the column to create a validator, but I have put a "Print" inside, and seen that it is executes lots of times, but I want to execute the validation only when the value of the column change !
    How can I do this ? What do i need to use ?
    Regards,
    Trigger

    I have use John's solution, it works well !
    Sorry vinod_t_krishnan i am good with java but i don't know how to use well EL Expressions so I did not try your method...
    The code if so is interested...
        public boolean validateOvpdOvprCode(String ovpdovprcode) {
            RowIterator ovRubrique = this.getOvRubrique();
            RowIterator ovRubriqueType = this.getOvRubriqueType();
            String modifiable = (String)ovRubriqueType.getRowAtRangeIndex(0).getAttribute("OvrtModifiable");
            String majuscule = (String)ovRubrique.getRowAtRangeIndex(0).getAttribute("OvruMajuscule");
            String type = (String)ovRubrique.getRowAtRangeIndex(0).getAttribute("OvruTypeDonnee");
            BigDecimal repMin = (BigDecimal)ovRubrique.getRowAtRangeIndex(0).getAttribute("OvruRepMini");
            BigDecimal repMax = (BigDecimal)ovRubrique.getRowAtRangeIndex(0).getAttribute("OvruRepMaxi");
            modifiable = modifiable.toUpperCase();
            majuscule = majuscule.toUpperCase();
            type = type.toUpperCase();
            BigDecimal ovprBD = null;
            if (modifiable.equals("N")) {
                errorMessage = "Ce champ n'est pas modifiable ! Actualisez la page pour réinitialiser sa valeur !";
                return false;
            } else {
                if (ovpdovprcode == null)
                    return true;
                if (type.equals("N")) {
                    float ovprInt = 0;
                    try {
                        ovprInt = Float.parseFloat(ovpdovprcode);
                        ovprBD = new BigDecimal(ovprInt);
                    } catch (Exception e) {
                        errorMessage =
                                "Ce champ est de type numérique, il ne doit contenir que des chiffres et un 'point'";
                        return false;
                    if(repMin != null && repMax != null)
                        if(ovprBD.compareTo(repMin) == -1 || ovprBD.compareTo(repMax) == 1) {
                            System.out.println("4");
                            errorMessage = "La réponse doit être comprise entre " + repMin + " et " + repMax + ".";
                            return false;
                if (majuscule.equals("O"))
                    if (!ovpdovprcode.equals(ovpdovprcode.toUpperCase())) {
                        errorMessage = "Ce champ doit comporter uniquement des majuscules";
                        return false;
                return true;
        }

  • CQL on complex java bean

    Hello,
    Is there a known issue of CQL not able to process a complex java bean structure? Simple java bean works just fine, but when I have bean nested in another bean, CQL can not process it.
    Any pointer is greatly appreciated.
    Thanks,
    Brandon

    Hi,
    I am using the latest 11.1.1.3. Bellow is the error.
    <May 25, 2010 12:38:00 PM PDT> <Warning> <Ede> <BEA-000000> <Exception for 'com.event.Subscriber@2bd2877' raised by listener = com.oracle.cep.processor.cql.impl.CQLEventReceiver@299f722
    com.bea.wlevs.ede.api.EventProcessingException: Internal error processing event [com.event.Subscriber@2bd2877] = Failed to set property [agreement] of event type [Subscriber]. Cause = invalid object com.event.agreement@2bd2873 is used for object attribute value
         at com.oracle.cep.processor.cql.impl.CQLEventReceiver.sendToEngine(CQLEventReceiver.java:389)
         at com.oracle.cep.processor.cql.impl.CQLEventReceiver.onInsertEvent(CQLEventReceiver.java:248)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEventToListener(EventSenderImpl.java:360)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEvent(EventSenderImpl.java:331)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventstore.recplay.RecordPlaySendEventInterceptor.sendInsertEvent(RecordPlaySendEventInterceptor.java:160)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventinspector.EventInspectInterceptor.sendInsertEvent(EventInspectInterceptor.java:133)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.monitor.internal.MonitorSendEventInterceptor.sendInsertEvent(MonitorSendEventInterceptor.java:480)
         at com.bea.wlevs.channel.impl.ChannelImpl.onInsertEvent(ChannelImpl.java:439)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEventToListener(EventSenderImpl.java:360)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEvent(EventSenderImpl.java:331)
         at com.bea.wlevs.ede.impl.EventSourceEventSenderImpl.sendInsertEvent(EventSourceEventSenderImpl.java:86)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventstore.recplay.RecordPlaySendEventInterceptor.sendInsertEvent(RecordPlaySendEventInterceptor.java:160)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventinspector.EventInspectInterceptor.sendInsertEvent(EventInspectInterceptor.java:133)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.monitor.internal.MonitorSendEventInterceptor.sendInsertEvent(MonitorSendEventInterceptor.java:480)
         at com.bea.wlevs.adapters.jms.InboundJmsAdapter.onMessage(InboundJmsAdapter.java:187)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:544)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
         at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
         at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
         at com.bea.core.asyncbeans.internal.DefaultMessageListenerContainer.receiveAndExecute(DefaultMessageListenerContainer.java:59)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:983)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
         at com.bea.core.asyncbeans.internal.WorkManagerTaskExecutor$1.run(WorkManagerTaskExecutor.java:39)
         at weblogic.work.commonj.CommonjWorkManagerImpl$WorkWithListener.run(CommonjWorkManagerImpl.java:196)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused By: com.bea.wlevs.ede.api.EventPropertyException: Failed to set property [agreement] of event type [Subscriber]. Cause = invalid object com.event.agreement@2bd2873 is used for object attribute value
         at com.oracle.cep.processor.cql.impl.TupleValueUtils.raiseEventPropertyException(TupleValueUtils.java:153)
         at com.oracle.cep.processor.cql.impl.TupleValueUtils.projectEvent(TupleValueUtils.java:90)
         at com.oracle.cep.processor.cql.impl.TupleValueUtils.compareAndProjectEvent(TupleValueUtils.java:48)
         at com.oracle.cep.processor.cql.impl.CQLEventReceiver.sendToEngine(CQLEventReceiver.java:337)
         at com.oracle.cep.processor.cql.impl.CQLEventReceiver.onInsertEvent(CQLEventReceiver.java:249)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEventToListener(EventSenderImpl.java:360)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEvent(EventSenderImpl.java:331)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventstore.recplay.RecordPlaySendEventInterceptor.sendInsertEvent(RecordPlaySendEventInterceptor.java:160)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventinspector.EventInspectInterceptor.sendInsertEvent(EventInspectInterceptor.java:133)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.monitor.internal.MonitorSendEventInterceptor.sendInsertEvent(MonitorSendEventInterceptor.java:480)
         at com.bea.wlevs.channel.impl.ChannelImpl.onInsertEvent(ChannelImpl.java:439)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEventToListener(EventSenderImpl.java:360)
         at com.bea.wlevs.processor.impl.EventSenderImpl.sendInsertEvent(EventSenderImpl.java:331)
         at com.bea.wlevs.ede.impl.EventSourceEventSenderImpl.sendInsertEvent(EventSourceEventSenderImpl.java:86)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventstore.recplay.RecordPlaySendEventInterceptor.sendInsertEvent(RecordPlaySendEventInterceptor.java:160)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.eventinspector.EventInspectInterceptor.sendInsertEvent(EventInspectInterceptor.java:133)
         at com.bea.wlevs.ede.spi.AbstractSendEventInterceptor.sendInsertEvent(AbstractSendEventInterceptor.java:79)
         at com.bea.wlevs.monitor.internal.MonitorSendEventInterceptor.sendInsertEvent(MonitorSendEventInterceptor.java:480)
         at com.bea.wlevs.adapters.jms.InboundJmsAdapter.onMessage(InboundJmsAdapter.java:187)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:544)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
         at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
         at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
         at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
         at com.bea.core.asyncbeans.internal.DefaultMessageListenerContainer.receiveAndExecute(DefaultMessageListenerContainer.java:59)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:983)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
         at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
         at com.bea.core.asyncbeans.internal.WorkManagerTaskExecutor$1.run(WorkManagerTaskExecutor.java:39)
         at weblogic.work.commonj.CommonjWorkManagerImpl$WorkWithListener.run(CommonjWorkManagerImpl.java:196)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

  • Complex Java Bean Model in WD

    I've revised the question.. to make it more simple.
    I have 2 wrapper classes, the first wrapper HAS the second wrapper as an object.
    When importing the Java Bean Model in WebDynpro, it seems okay - did the context binding, etc. -- until I did an "Apply Template" (as form) on the layout based on the CommandBean (which has the wrapper class).
    Now, the fields are not active fields.. I can't change the cardinality -- and I have played around with the relations of the model classes with each other.
    Nothing seems to work
    Please help.
    Edited by: Jan Michael Jaudian on Oct 8, 2008 8:07 AM

    problem solved.
    forgot to completely bind inner nodes.
    developers who need more info, do post here so I can help out in any way I can.
    Cheers!

  • Bean:write and complex types

    I have a Java object like that:
    public class OBJ1 {
    String name;
    String id;
    OBJ2 [] Array_OBJ2;
    // getters and setters methods for name,id and Array_OBJ2
    OBJ2 is an an object like this:
    public class OBJ2 {
    String surname;
    OBJ3 [] Array_OBJ3;
    // getters and setters methods for surname and Array_OBJ3
    And OBJ3 is like this:
    public class OBJ3 {
    String control;
    // getters and setters methods for control
    I passed a OBJ1 object to a jsp page and I can access to "name" and "id" properties successfully, but I have problems to access to the "Array_OBJ2" object.
    What's the correct syntax in the jsp page to access it in a bean:write tag ?

    Hi
    I am not sure just thinking and guessing try this.......
    <logic:iterate name="OBJ1" id="item" property="Array_OBJ2">
        <bean:write name="item" />
    </logic:iterate>do reply wheather it works or not

  • Can not run complex report with ReportClientDocument using POJO beans.

    Hi All,
    Any help would be very appreciated I have been stack on this issue for the last 4 hours.
    My report has parameters, a ResultSet and subreports that themselves have both parameters and ResultSet.
    The report runs well in Crystal Report Designer but not on my application with ReportClientDocument API.
    The excpeiton I am getting is:
    ======================================================================
    Caused by: java.lang.NullPointerException
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.ParameterFieldController.do(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.bs.byte(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.a3.if(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.else(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.r.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.proxy.remoteagent.h.for(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setDataSource(Unknown Source)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.businessobjects.BODocumentProvider.generateDocument(BODocumentProvider.java:178)
    16:22:56,796 INFO  [STDOUT]      at com.tramada.documents.service.impl.DocumentServiceImpl.generateDocumentContent(DocumentServiceImpl.java:125)
    16:22:56,796 INFO  [STDOUT]      ... 58 more
    This is my class that is trying to do the work.:
    ======================================================================
    BODocumentProvider.java Created on 19/05/2008
    This software is the confidential and proprietary information of Tramada
    Systems Pty Limited.
    package com.tramada.documents.businessobjects;
    import java.io.ByteArrayInputStream;
    import java.util.List;
    import java.util.Locale;
    import com.businessobjects.samples.pojo.POJOResultSetFactory;
    import com.crystaldecisions.sdk.framework.CrystalEnterprise;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
    import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory;
    import com.crystaldecisions.sdk.occa.report.application.ISubreportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.ParameterFieldController;
    import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.application.SubreportController;
    import com.crystaldecisions.sdk.occa.report.data.Fields;
    import com.crystaldecisions.sdk.occa.report.data.IField;
    import com.crystaldecisions.sdk.occa.report.data.ITable;
    import com.crystaldecisions.sdk.occa.report.data.Tables;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    import com.tramada.core.utils.SoftMap;
    import com.tramada.documents.DocumentDataProvider;
    import com.tramada.documents.DocumentDescriptor;
    import com.tramada.documents.DocumentFormat;
    import com.tramada.documents.DocumentProvider;
    import com.tramada.documents.SubDocumentDescriptor;
    import com.tramada.documents.businessobjects.model.Template;
    import com.tramada.documents.model.DocumentContent;
    import com.tramada.persistence.home.GenericHome;
    Business Objects specific Document Provider.
    public class BODocumentProvider implements DocumentProvider {
        private static final String BO_AUTH_TYPE = "secEnterprise";
        private boolean connect;
        private String userName;
        private String userPassword;
        private String boURL;
        private String documentsFolder;
        private GenericHome home;
    Local cache. Keeps track of document source for better performance.
        private SoftMap<String, ReportClientDocument> cachedSources = new SoftMap<String, ReportClientDocument>();
        // SETTERS & GETTERS
        // SETTERS & GETTERS
        public GenericHome getHome() {
            return home;
        public void setHome(GenericHome home) {
            this.home = home;
        public boolean getConnect() {
            return connect;
        public void setConnect(boolean connect) {
            this.connect = connect;
        public String getBoURL() {
            return boURL;
        public void setBoURL(String boURL) {
            this.boURL = boURL;
        public String getUserName() {
            return userName;
        public void setUserName(String userName) {
            this.userName = userName;
        public String getUserPassword() {
            return userPassword;
        public void setUserPassword(String userPassword) {
            this.userPassword = userPassword;
        public String getDocumentsFolder() {
            return documentsFolder;
        public void setDocumentsFolder(String documentsFolder) {
            this.documentsFolder = documentsFolder;
        // PUBLIC INTERFACE
    Generates a document given its descriptor.
    @param descriptor
               valid document descriptor
    @return Document (generated document).
        public DocumentContent generateDocument(DocumentDescriptor descriptor, DocumentFormat format) throws Exception {
            if (descriptor == null) {
                throw new IllegalArgumentException("descriptor==null");
            if (format == null) {
                throw new IllegalArgumentException("format==null");
            // get the document source.
            // Can not use setDataSource() error code 2147483648?
            ReportClientDocument document = getDocument(descriptor.getDocumentName());
            ParameterFieldController parameterController = document.getDataDefController().getParameterFieldController();
            // insert the main document parameters and there values
            populateParameters(document.getDataDefController().getDataDefinition().getParameterFields(),
                    parameterController, descriptor, "");
            // insert into the main document all the required data.
            Tables tables = document.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++) {
                ITable table = tables.getTable(i);
                String tableAlias = table.getAlias();
                DocumentDataProvider provider = descriptor.getDocumentDataProvider(tableAlias);
                POJOResultSetFactory factory = new POJOResultSetFactory(provider.getDataType());
                document.getDatabaseController().setDataSource(factory.createResultSet(provider.getData()), tableAlias,
                        tableAlias);
            // go through all the sub-documents and do the same thing as for the
            // main document.
            SubreportController subReportController = document.getSubreportController();
            IStrings names = subReportController.getSubreportNames();
            for (int i = 0; i < names.size(); i++) {
                String subDocumentName = (String) names.get(i);
                SubDocumentDescriptor subDescriptor = descriptor.getSubDocument(subDocumentName);
                // get the actual sub document.
                ISubreportClientDocument subDocument = subReportController.getSubreport(subDocumentName);
                // insert the subdocument parameters.
                populateParameters(subDocument.getDataDefController().getDataDefinition().getParameterFields(),
                        parameterController, subDescriptor, subDocumentName);
                // insert into the main document all the required data.
                Tables subTables = subDocument.getDatabaseController().getDatabase().getTables();
                for (int j = 0; j < subTables.size(); j++) {
                    ITable subTable = subTables.getTable(j);
                    String tableAlias = subTable.getAlias();
                    DocumentDataProvider subProvider = subDescriptor.getDocumentDataProvider(tableAlias);
                    POJOResultSetFactory subFactory = new POJOResultSetFactory(subProvider.getDataType());
                    subDocument.getDatabaseController().setDataSource(subFactory.createResultSet(subProvider.getData()),
                            tableAlias, tableAlias);
            // generate the report in the specified format
            ByteArrayInputStream bais = (ByteArrayInputStream) document.getPrintOutputController().export(
                    getReportFormat(format));
            byte[] content = new byte[bais.available()];
            bais.read(content);
            return (new DocumentContent(content));
    Refreshes the connector and all its cached document sources.
        public void refresh() throws Exception {
            cachedSources.clear();
        // PRIVATE ROUTINES
    Populates the document parameters with there values.
        private void populateParameters(Fields parameters, ParameterFieldController controller,
                DocumentDescriptor descriptor, String documentName) throws Exception {
            for (int i = 0; i < parameters.size(); i++) {
                IField parameter = parameters.getField(i);
                String parameterName = parameter.getName();
                if (!descriptor.getParameters().containsKey(parameterName)) {
                    throw new IllegalStateException("missing parameter entry for '" + parameterName + "'");
                Object value = descriptor.getParameter(parameterName);
                if (value != null) {
                    controller.setCurrentValue(documentName, parameterName, value);
    Retrieves the document source. If the source is not cached get it from
    BO. First get the template name that is stored on BO.
        private ReportClientDocument getDocument(String documentName) throws Exception {
            ReportClientDocument source = cachedSources.get(documentName);
            if (source == null) {
                String templateName = getTemplateName(documentName);
                if (userName == null) {
                    throw new IllegalArgumentException("user-name==null");
                if (userPassword == null) {
                    throw new IllegalArgumentException("user-password==null");
                if (boURL == null) {
                    throw new IllegalArgumentException("boURL==null");
                if (documentsFolder == null) {
                    throw new IllegalArgumentException("documents-folder==null");
                // login to BO
                IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userName, userPassword,
                        boURL, BO_AUTH_TYPE);
                IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
                // get the application folder.
                IInfoObjects folders = iStore.query("Select SI_ID From CI_INFOOBJECTS Where SI_PROGID='CrystalEnterprise.Folder' And SI_NAME = '"
                        + documentsFolder + "'");
                if (folders.size() != 1) {
                    throw new IllegalStateException("documents folder '" + documentsFolder + "' not found on BO Server '"
                            + boURL + "'.");
                IInfoObject folder = (IInfoObject) folders.get(0);
                // get the document identified by the template name.
                IInfoObjects templates = iStore.query("select SI_ID, SI_NAME From CI_INFOOBJECTS "
                        + "where SI_PROGID = 'CrystalEnterprise.Report' " + "And SI_INSTANCE_OBJECT = 0 "
                        + "And SI_PARENT_FOLDER = " + folder.getID() + " And SI_NAME= '" + templateName + "'");
                if (templates.size() != 1) {
                    throw new IllegalStateException("template with name '" + templateName + "' not found in folder '"
                            + documentsFolder + "'on BO Server '" + boURL + "'.");
                source = ((IReportAppFactory) enterpriseSession.getService("RASReportFactory")).openDocument(
                        ((IInfoObject) templates.get(0)).getID(), 0, Locale.getDefault());
                cachedSources.put(documentName, source);
            return (source);
    Returns the associated template name for the given document descriptor.
        @SuppressWarnings("unchecked")
        private String getTemplateName(String documentName) {
            Template example = new Template();
            example.setDocumentName(documentName);
            List<Template> templates = (List<Template>) home.findByExampleExcludingAssociations(example);
            if (templates == null || templates.size() != 1) {
                throw new IllegalStateException("no template defined for document name '" + documentName + "'");
            return (templates.get(0).getTemplateName());
    Get the equivalent BO format for the given document format.
    @param format
               document format.
    @return ReportExportFormat
        private ReportExportFormat getReportFormat(DocumentFormat format) {
            if (format.equals(DocumentFormat.PDF)) {
                return (ReportExportFormat.PDF);
            } else if (format.equals(DocumentFormat.WORD)) {
                return (ReportExportFormat.MSWord);
            } else if (format.equals(DocumentFormat.EXCEL)) {
                return (ReportExportFormat.MSExcel);
            return (ReportExportFormat.MSWord);
    Best Regards
    Khalef  Bessaih

    Hello,
    If I understand correctly, you create a local report which choose report from Report Server. You have two query parameters in the report which are returned by stored procedure. Currently, you cannot get default values for these parameters when run the report.
    Based on my test, if we haven’t configure these parameter with Available Values, we can reproduce the same issue. Also, caching issue may cause the same issue. If the issue is persist, please delete the corresponding report in the report server. Then, redeploy
    it to check.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/en-US/6a548d65-35d0-4a3e-8b64-3b7b655c76ee/ssrs-2008-report-parameter-default-value-doesnt-work-when-deployed
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • What is the better way to open and close connection in bean

    Hello, may i ask about the best way to open and close the connection?
    At the first, the connection code is store in Conn class bean. The JSP page will call a method in Process bean to process the query and update of database. the Process bean is using th Conn to connect to database.
    In my process bean, it have a method for each type of sql like select, insert, update, and delete for each tables. Each method will call the Conn to open and close the connection. The jsp page can simply call a method retrieve or update records.
    However, when calling the processUpdate method, it is a method that update a group of tables base on the query result of another group of tables and calculation. If I calling the query method in the same bean file, it will open and close the connection many times (more than 1000 times). After open and close the connection several times, the connection to mySQL will be fail.
    Currently, i include 2 method in Process that is only calling the Conn to open the connection and close connection. When calling the openConnection method, it will also set the boolean connected in the class to true and call Conn to open connection. When calling the closeConnection method, it will also set the boolean connected in the class to false and call Conn to close connection.
    After that, i add some change to the query method which is when the connected is false, it will open the connection by calling the Conn and close the connection themself. If the connected is true, it will not call the Conn to open and close the connection because it already connected to the database.
    Now, i when i calling the query method in jsp, it can open the connection and close the connection individually. When i call the processUpdate in the jsp, this method will calling the openConnection before calling the query and calling closeConnection at the end. It not only faster the process(less open and close), it also no cause the connect to mySQL fail error again. However, it also make the coding in the bean file more longer and complex.
    Is there have any better solution?

    Use connection pooling. This will put the connection management in the hands of the webserver, not your code. Check out this post:
    http://forum.java.sun.com/thread.jspa?threadID=741788&messageID=4252932#4252932

  • Problem with 1-to-many relationship between entity beans

    Hi All!
    I have two tables TMP_GROUP and TMP_EMPLOYEE with following fields:
    TMP_GROUP: ID, CAPTION, COMMENT, STATUS.
    TMP_EMPLOYEE: ID, LOGIN, GROUP_ID.
    For this tables i create two entity beans GROUP and EMPLOYEE respectively.
    The relationship looks like this
    descriptor ejb.xml:
    <ejb-relation>
                <description>description</description>
                <ejb-relation-name>employeesOfGroup</ejb-relation-name>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.mypackage.GroupBean</ejb-relationship-role-name>
                    <multiplicity>One</multiplicity>
                    <relationship-role-source>
                        <ejb-name>GroupBean</ejb-name>
                    </relationship-role-source>
                    <cmr-field>
                        <cmr-field-name>employees</cmr-field-name>
                        <cmr-field-type>java.util.Collection</cmr-field-type>
                    </cmr-field>
                </ejb-relationship-role>
                <ejb-relationship-role>
                    <ejb-relationship-role-name>com.mypackage.EmployeeBean</ejb-relationship-role-name>
                    <multiplicity>Many</multiplicity>
                    <relationship-role-source>
                        <ejb-name>EmployeeBean</ejb-name>
                    </relationship-role-source>
                </ejb-relationship-role>
            </ejb-relation>
    descriptor persistent.xml:
    <table-relation>
                   <table-relationship-role
                        key-type="PrimaryKey">
                        <ejb-name>GroupBean</ejb-name>
                        <cmr-field>employees</cmr-field>
                   </table-relationship-role>
                   <table-relationship-role
                        key-type="NoKey">
                        <ejb-name>EmployeeBean</ejb-name>
                        <fk-column>
                             <column-name>GROUP_ID</column-name>
                             <pk-field-name>ejb_pk</pk-field-name>
                        </fk-column>
                   </table-relationship-role>
              </table-relation>
    Now i implement business method:
    public Long addEmployee(String login, long groupId) {
              Long result;
              try {
                   EmployeeLocal employee = employeeHome.create(login);
                   GroupLocal group =
                        groupHome.findByPrimaryKey(new Long(groupId));
                   Collection employees = group.getEmployees();
                   employees.add(employee);
                   result = (Long) employee.getPrimaryKey();
              } catch (CreateException ex) {
                   result = new Long(0);
              } catch (FinderException ex) {
                   result = new Long(0);
              return result;
    When i call this method from web service, the following exception is raised:
    com.sap.engine.services.ejb.exceptions.BaseTransactionRolledbackLocalException: Exception in method com.mypackage.GroupLocalHomeImpl0.findByPrimaryKey(java.lang.Object).
    P.S.
    1) I have transaction attribute set to "Required" for all methods of all beans
    2) I have unique index for each table:
    TMP_GROUP_I1: CAPTION
    TMP_EMPLOYEE_I1: LOGIN (however i think GROUP_ID must be added here too)
    3) I tried many:many relationship with this tables and it works fine
    4) I try another implementation of addEmployee method with
    EmployeeLocal employee = employeeHome.create(login, groupId);
    without using GroupLocal cmr-field and GroupLocalHome findByPrimaryKey method, the result is same error.
    Can somebody help me with this problem?
    Thanks in advance.
    Best regards, Abramov Andrey.

    gimbal2 wrote:
    1: The @JoinColumn on the listOfDepartments collection in Company is wrong. It should be something like this for a bidirectional relationship:
    @OneToMany(mappedBy="company") // company is the matching property name in Department
    private List <Department> listOfDepartment = new ArrayList<Department>();Note that I removed the fetch configuration; onetomany is fetched lazy by design. Saves some clutter eh.
    2: use a Set in stead of a List (hibernate doesn't like lists much in entities and will break when you create slightly more complex entity relations)
    3: don't just slap cascades on collections, especially of type ALL. Do it with care. In the many years I've been using JPA I've only had to cascade deletes in very specific situations, maybe once or twice. I never needed any of the other cascade types, they just invite sloppy code if you ask me. When working with persistence you should apply a little precision.I made all changes as you mentioned but still compID in department table shows null value...

  • Generate PDF using Managed Bean with custom HTTP headers

    Background
    Generate a report in various formats (e.g., PDF, delimited, Excel, HTML, etc.) using JDeveloper 11g Release 2 (11.1.2.3.0) upon clicking an af:commandButton. See also the StackOverflow version of this question:
    http://stackoverflow.com/q/13654625/59087
    Problem
    HTTP headers are being sent twice: once by the framework and once by a bean.
    Source Code
    The source code includes:
    - Button Action
    - Managed Bean
    - Task Flow
    Button Action
    The button action:
    <af:commandButton text="Report" id="submitReport" action="Execute" />
    Managed Bean
    The Managed Bean is fairly complex. The code to `responseComplete` is getting called, however it does not seem to be called sufficiently early to prevent the application framework from writing the HTTP headers.
    HTTP Response Header Override
    * Sets the HTTP headers required to indicate to the browser that the
    * report is to be downloaded (rather than displayed in the current
    * window).
    protected void setDownloadHeaders() {
    HttpServletResponse response = getServletResponse();
    response.setHeader( "Content-Description", getContentDescription() );
    response.setHeader( "Content-Disposition", "attachment, filename="
    + getFilename() );
    response.setHeader( "Content-Type", getContentType() );
    response.setHeader( "Content-Transfer-Encoding",
    getContentTransferEncoding() );
    Issue Response Complete
    The bean indirectly tells the framework that the response is handled (by the bean):
    getFacesContext().responseComplete();
    Bean Run and Configure
    public void run() {
    try {
    Report report = getReport();
    configure(report.getParameters());
    report.run();
    } catch (Exception e) {
    e.printStackTrace();
    private void configure(Parameters p) {
    p.put(ReportImpl.SYSTEM_REPORT_PROTOCOL, "http");
    p.put(ReportImpl.SYSTEM_REPORT_HOST, "localhost");
    p.put(ReportImpl.SYSTEM_REPORT_PORT, "7002");
    p.put(ReportImpl.SYSTEM_REPORT_PATH, "/reports/rwservlet");
    p.put(Parameters.PARAM_REPORT_FORMAT, "pdf");
    p.put("report_cmdkey", getReportName());
    p.put("report_ORACLE_1", getReportDestinationType());
    p.put("report_ORACLE_2", getReportDestinationFormat());
    Task Flow
    The Task Flow calls Execute, which refers to the bean's `run()` method:
    entry -> main -> Execute -> ReportBeanRun
    Where:
    <method-call id="ReportBeanRun">
    <description>Executes a report</description>
    <display-name>Execute Report</display-name>
    <method>#{reportBean.run}</method>
    <outcome>
    <fixed-outcome>success</fixed-outcome>
    </outcome>
    </method-call>
    The bean is assigned to the `request` scope, with a few managed properties:
    <control-flow-rule id="__3">
    <from-activity-id>main</from-activity-id>
    <control-flow-case id="ExecuteReport">
    <from-outcome>Execute</from-outcome>
    <to-activity-id>ReportBeanRun</to-activity-id>
    </control-flow-case>
    </control-flow-rule>
    <managed-bean id="ReportBean">
    <description>Executes a report</description>
    <display-name>ReportBean</display-name>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    The `<fixed-outcome>success</fixed-outcome>` strikes me as incorrect -- I don't want the method call to return to another task.
    Restrictions
    The report server receives requests from the web server exclusively. The report server URL cannot be used by browsers to download directly, for security reasons.
    Error Messages
    The error message that is generated:
    Duplicate headers received from server
    Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple distinct Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.Nevertheless, the report is being generated. Preventing the framework from writing the HTTP headers would resolve this issue.
    Question
    How can you set the HTTP headers in ADF while using a Task Flow to generate a PDF by calling a managed bean?
    Ideas
    Some additional ideas:
    - Override the Page Lifecycle Phase Listener (`ADFPhaseListener` + `PageLifecycle`)
    - Develop a custom Servlet on the web server
    Related Links
    - http://www.oracle.com/technetwork/middleware/bi-publisher/adf-bip-ucm-integration-179699.pdf
    - http://www.slideshare.net/lucbors/reports-no-notes#btnNext
    - http://www.techartifact.com/blogs/2012/03/calling-oracle-report-from-adf-applications.html?goback=%2Egde_4212375_member_102062735
    - http://docs.oracle.com/cd/E29049_01/web.1112/e16182/adf_lifecycle.htm#CIABEJFB
    Thank you!

    The problem was that the HTTP headers were in fact being written twice:
    1. The report server was returning HTTP response headers.
    2. The bean was including its own HTTP response headers (as shown in the question).
    3. The bean was copying the entire contents of the report server response, including the headers, into the output stream.
    Firefox ignored the duplicate header errors, but Google Chrome did not.

  • 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.

  • Multiple instances of the same bean class in session?

    I�m trying to think of a way to have multiple instances of the same bean class in session scope using JSF. For example, let�s say that I have two <h:dataTable>s on the same page. They both use the backing bean called genericBean. Now, the content for genericBean will be different for each <h:dataTable>. In fact, the data source that backs genericBean is not known until runtime. It could be a database, web service, etc.
    What I would like is for when JSF needs access genericBean instead of looking for the value with key �genericBean� in the session map it looks for �genericBean_[some runtime ID]�. I could specify this id in EL on a custom component, as a request parameter or whatever.
    I think that I need the bean to be in session scope because the tables are complex and I want them to be editable.
    I have some ideas about how I can do this but I was wondering if someone has already solved this problem or if there is a standard way to do this using tools like Shale, etc.
    Thanks,
    Randy

    Well, I came up with an interesting solution to this so I thought that I would post it here.
    I have a page that looks like this.
    <html>
    <head>
    <title>My Page</title>
    </head>
    <body>
    <f:view>
    <f:subview id="component1">
    <jsp:include page="component.jsp">
    <jsp:param name="id" value="a" />
    </jsp:include>
    </f:subview>
    <hr>
    <f:subview id="component2">
    <jsp:include page="component.jsp">
    <jsp:param name="id" value="b" />
    </jsp:include>
    </f:subview>
    </f:view>
    </body>
    </html>
    And component.jsp looke like this.
    <f:verbatim>
    <p>
    <h1>Component
    </f:verbatim>
    <h:outputText value=" #{param.id}" />
    <f:verbatim>
    </h1>
    </p>
    </f:verbatim>
    <h:form>
    <h:outputText value="#{component.id}" />
    <h:outputText value="#{component.value}" />
    <h:commandButton value="increment" action="#{component.increment}" />
    <h:commandButton value="decrement" action="#{component.decrement}" />
    <f:verbatim>
    <input type="hidden" name="id"
    value="</f:verbatim><h:outputText value="#{param.id}"/><f:verbatim>" />
    </f:verbatim>
    </h:form>
    The idea is that I want component.jsp to be initialized differently based on the id param. The component managed bean is configured to be in session scope but I want the component instance for id a and id b to be different instances in session scope. Therefore, I added a custom variable resolver to handle this.
    public Object resolveVariable(FacesContext context, String name) {
    // This id will be different for the different subviews.
    HttpServletRequest request = (HttpServletRequest) context.getExternalContext() .getRequest();
    String id = request.getParameter("id");
    // If there is an id in the request then check if this is a bean that can have multiple
    // instances in session scope.
    if ((id != null) && (id.length() > 0)) {
    ExternalContext ec = context.getExternalContext();
    // Build the new name for the key of this bean
    String newName = name + "_" + id;
    Object value = null;
    // See if the bean instance already esists.
    if ((null == (value = ec.getRequestMap().get(newName))) &&
    (null == (value = ec.getSessionMap().get(newName))) &&
    (null == (value = ec.getApplicationMap().get(newName)))) {
         // We could not find the bean instance in scope so create the bean
         // using the standard variable resolver.
    value = original.resolveVariable(context, name);
    // Now check if the bean implements that page component interface. If it is
    // a page component then we want to rename the key to access this bean so
    // that the instance is only used when the id is provided in the request.
    // For example, if there are two components (a and b) we will have in session scope
    // component_a and component_b. The will each point to a unique instance of the
    // Component bean class.
    if (value instanceof PageComponent) {
    // Try to get the value again
    if (null != (value = ec.getRequestMap().get(name))) {
         // Initialize the bean using the id
    ((PageComponent) value).initInstance(id);
    ec.getRequestMap().remove(name);
    ec.getRequestMap().put(newName, value);
    } else if (null != (value = ec.getSessionMap().get(name))) {
    ((PageComponent) value).initInstance(id);
    ec.getSessionMap().remove(name);
    ec.getSessionMap().put(newName, value);
    } else if (null != (value = ec.getApplicationMap().get(name))) {
    ((PageComponent) value).initInstance(id);
    ec.getApplicationMap().remove(name);
    ec.getApplicationMap().put(newName, value);
    return value;
    return original.resolveVariable(context, name);
    }

  • Error while returning complex data type in a J2EE web service

    Hello,
    I am implementing J2EE web service which returns array of custom class object.
    I have implemented serializable interface to custom class, and also to session bean.
    But it gives the following error:
    Serializing object [Lcom.ltitl.j2ee.ejb.classes.ProjectDetails;@2a2289 fails. Nested message: XML Serialization Error. Object of Class [com.ltitl.j2ee.ejb.classes.ProjectDetails] does not have property [ObjId] of type [java.lang.Integer]. Check if the right object is passed to the serialization routine..
    As error stated about some property ObjId..I tried including such property in my class. But now it gave exception while deploying stating that ObjId already defined.
    Also I want to return multiple arrays of complex custom classes. i tried using vectors but didnt work. What is the method to return arrays of complex custom classes.
    Please help..
    Abhijeet

    Trying to create a web service that returns a Collection doesn't seem to be possible in Netweaver. The reason for this is that languages other than Java have difficulty in mapping Collections, amongst others, to their own native equivalents.
    There is a discussion on the subject here you may find useful:
    http://forum.capescience.com/showthreaded.php?Cat=&Board=webservices&Number=147&page=0&view=collapsed&sb=5&o=&vc=1
    The short answer is to use object Arrays instead, or a custom class that contains an array of each type of object you would expect to find in your Vector
    Hope this helps
    Steve

Maybe you are looking for

  • Iweb website wont go on domain name

    i purchased a domain name from network solutions, and made my iweb website, which i will be hosting with mpbileme. i then changed the CNAME (alias) to web.me.com on www, and followed all the instructions, howevermy website has not been uploaded to th

  • SAP -ISU PrintWorkBench

    Can some one help me with the procedure to use SAP-ISU Print WorkBench

  • Kernel26 compile error (trying to install Synce)

    Hi! I'm trying to patch kernel26 (using files from abs, version 2.6.21.1-8), with this patch: http://synce.svn.sourceforge.net/svnroo … -wm5.patch I'm following instructions here: http://www.synce.org/index.php/Connecti … is-lite%29 I copied the kern

  • Mail service X3-02 WILL NOT sign in HELP!

    agreed - just discovered problem TODAY why will it not let me complete setup of gmail as my mail service. mail create account = OK select gmail = OK select domain @gmail.com = OK enter usernam and password = OK click sign in = OK select wireless home

  • Game volume okay, but music is almost unhearable.

    Game volume okay, but music is almost unhearable. I have a problem with my XFI sound card in windows 7 when gaming. I own a XFI titanium PCI-E My OS is windows 7 64-bi home preium The problem is, when I play games the music whether its ingame music o