How to change the default class generator for your Hibernate Code Generator:

Add the hibernate-tools.jar to your java project.

Create this class in your project (i used the default package):

import org.hibernate.cfg.reveng.*;
public class MyRevEngStrategy extends DefaultReverseEngineeringStrategy {
public String getTableIdentifierStrategyName(org.hibernate.cfg.reveng.TableIdentifier t) {return "native"; }
}

in your Hibernate Code Generator, click on browse next to reveng.strategy.
in the textbox type in MyRevEngStrategy, it should find it.

Close and run.






--- In [email protected], "Benno Kittelmann" <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> I have the following (simplified) setup: An ArrayCollection is bound
> to the dataProvider attribute of a DataGrid. The values of the
> ArrayCollection are loaded by a DataService during startup of the
> application. Additionally, there is a form which is used to create new
> managed objects. Whenever the form is submitted, a new object is
> created, and after a call to to createItem() it is persisted on the
> server, and some seconds later displayed in the DataGrid. So far so
> good.
>
> Here's the problem though: If I try to directly add another object, I
> get the error message "Item with id '0' already exists'. And the
> object does not display in the DataGrid.
>
> The object I'm trying to add/persist looks like this:
>
> package myPackage
> {
> [Managed]
> [RemoteClass(alias="myPackage.Item")]
> public class Item {
> public var id:int;
> public var name:String = "";
> }
> }
>
> and I'm trying to persist it like this:
>
> var newItem:Item = new Item();
> newItem.name = "foobar";
> dataservice.createItem(newItem);
>
> datagrid.dataProvider.refresh();
> Alert.show(String(newItem.id));
>
>
> The alert is showing me '0' as the newly generated id - which I
> suppose is to be expected, since the order of method calls is not
> synchronous. Anyway, when I monitor what's happening on the server, I
> see that a new Java object is successfully created and persisted to
> the database, and it gets the ID value set from the ORM tool
> (Hibernate). I suspected that then the dataservice notifies the Flash
> client that a new object exists, and that it should display it. My
> assumption was that the managed Item object would then have the newly
> generated ID instead of the default '0' value.
>
> I have the feeling I'm probably not doing things in the correct order
> or missing a crucial piece of information. How is one supposed to
> persist a managed object via createItem() and put that into a
> DataGrid? Does any article exist that showcases this situation? I've
> perused the Flex docs extensively, but did not find a good example
> that helped me resolve my problem.
>
> Thanks in advance,
> Benno Kittelmann
>
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to