Thanks a lot Jeff,
I have fds 2.0.1 so maybe you are right. I'll try the latest
version and turn on the debug on the server.
I'll let you know the results,
Carlos
--- In [email protected], "Jeff Vroom" <[EMAIL PROTECTED]> wrote:
>
> Hi Carlos,
>
>
>
> First of all, if you are not running the latest version LC DS 2.5.1
(FDS
> was renamed to LC DS), it may help to upgrade as we've both fixed a
few
> problems and also improved the diagnostics.
>
>
>
> The best way to diagnose these problems is to turn on the debug
logging
> on the server (services-config.xml for the patterns Message.* and
> DataService.*) and client (with the <mx:TraceTarget/>) tag.
>
>
>
> Hibernate also has some nice debug logging which shows the SQL that
is
> generated which is nice as well.
>
>
>
> I haven't heard of any problems where deleteItem just silently does
not
> delete the object. In some cases, there are rows which refer to
the row
> you want to delete and so the deleteItem will generate an error due
to
> the database integrity constraint. This can happen in particular
> because hibernate supports cascade="delete" behavior but DMS does
not
> have that yet. In these cases, you may have to delete the related
> objects before you delete the main object.
>
>
>
> In any case, the debug logs will show the details and so we can
figure
> out what is going on. If the logs are too big to send to the list,
feel
> free to send them to me off list ([EMAIL PROTECTED]) and I can help you
> out.
>
>
>
> Jeff
>
>
>
> ________________________________
>
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of targo_05
> Sent: Monday, September 17, 2007 4:44 PM
> To: [email protected]
> Subject: [flexcoders] insert / delete problems using FDS with
hibernate
>
>
>
> Hi everyone,
>
> I'd be very thankful if anyone could help me with this problem
> because I got stuck on it for several weeks.
>
> I'm developing a FDS application with database connection and I've
> mapped a relational database to POJO's with Hibernate (using
> hibernate tools). I'm experiencing a lot of problems when I try to
> insert and delete items using the hibernate assembler. Here is my
> situation.
>
> My database, which represents information about cars, contains five
> tables:
>
> MODEL
> id
> engine
> transmission
> cab
> bed
>
> MODEL_PACK
> model_id
> pack_id
> inclusion_type
>
> PACK
> id
> name
> category
>
> MODEL_COLOR
> model_id
> color_id
>
> COLOR
> id
> extColor
> intColor
>
> The AS classes that represent this schema:
>
> Model.as
>
> id:int;
> engine:string;
> transmission:string;
> cab:string;
> bed:string;
> colors:ArrayCollection;
> packs:ArrayCollection;
>
> ModelPack.as
>
> id:ModelPackId;
> model:Model;
> pack:Pack;
> inclusion:String;
>
> ModelPackId is a custom class to store the composite primary key
> which is mapped to the corresponding java POJO.
>
> Pack.as
>
> id:String;
> category:String;
> name:String;
> models:ArrayCollection;
>
> Color.as
>
> id:String;
> extColor:String;
> intColor:String;
> models:ArrayCollection;
>
> The corresponding destinations in data-management-config.xml:
>
> <destination id="models.hibernate">
> ...........
> <many-to-many property="colors"
> destination="colors.hibernate" lazy="false"/>
> <one-to-many property="packs"
> destination="ModelsPacks.hibernate" lazy="true"/>
> ..............................
>
> <destination id="colors.hibernate">
> .............................
> <many-to-many property="models"
> destination="models.hibernate" lazy="true"/>
> ....................................
>
> <destination id="ModelsPacks.hibernate">
> ....................
> <identity property="id"
> type="com.fds.proyecto.hibernate.ModelPackId"/>
> <many-to-one property="model"
> destination="models.hibernate" lazy="true"/>
> <many-to-one property="pack"
> destination="packs.hibernate" lazy="true"/>
> ...................
>
> <destination id="packs.hibernate">
> ...................
> <one-to-many property="models"
> destination="ModelsPacks.hibernate" lazy="true"/>
> .....................
>
> As you can see the relationships are bidirectional.
>
> For example I have the data service to manage the operations in the
> front end and a datagrid:
>
> <mx:DataService id="models_ds" destination="models.hibernate"
> result="handleResult(event)"/>
>
> <mx:DataGrid id="modelList" dataProvider="{models_ac}"/>
>
> and a button:
>
> <mx:Button label="Delete" id="btnDelete" click="delModel()"/>
>
> The callback function only uses the hibernate assembler to delete
the
> model:
>
> models_ds.deleteItem(modelList.selectedItem);
> models_ds.commit();
>
> It seems that the operation is performed succesfully but then when
I
> check the database or reload the application the model that I've
> tried to delete is still there with its corresponding packs and
> colors. Sometimes the application throws a runtime error about
> synchronization. I've tried to remove the relations in the AS
classes
> because I think that the problem have to do with the relations
> between classes and it works but in this case the application
doesn't
> meet my requirements and the delete operation is more complex.
> Similar problems happen when I try to add Items.
>
> I've tried a lot of solutions to fix that problem (remove
relations,
> convert them to unidirectional instead of bidirectional...) and I'd
> be deeply grateful if anyone can show me the procedure to add and
> delete items in that scenario. I've also thought that I could have
> missed any tag like "cascade" in the hibernate mapping files but I
> haven't tried this solution because I don't know what does it
exactly
> mean.
>
> I have heard that the hibernate assembler has some bugs and in some
> circumstances it doesn't work properly. Could anyone confirm that?
If
> true what should be the alternative solution? It's very important
for
> me because this is a small part of my dissertation and I can't
> continue because I got stuck on this issue.
>
> Thanks a lot in advance,
>
> Carlos
>