|Re: resync Tables to Entities? [message #617687 is a reply to message #617684]
||Wed, 09 December 2009 17:54
| Neil Hauge
Registered: July 2009
In Dali, Entity Generation from Tables was developed as a starting point for your entities where you have an existing database schema. Entity Generation is not meant to generate a perfect model and should not take the place of developing a well designed object oriented model. That is to say that it is expected that further modification to these generated Entities will normally be required. As a result of these changes, which may be structural in nature, it would be difficult to sync database changes with the existing entities.
If the database schema is only undergoing small, incremental changes, than the best thing for you to do would be to simply edit your existing classes/entities by adding/changing the necessary fields and mapping them in the Java Editor or by using Dali's rich UI for configuring entities (Details View).
By using the UI, Dali will manage all of the annotations in the code, and will also provide you with their default values. In addition to this, when the database schema changes, Dali validation will indicate where existing mappings are no longer correct so you know where changes are necessary.
We don't yet validate queries, but this is something slated for the future.
In summary, Entity Generation should be used for prototyping and/or quick way to get started with your entities. If the database schema is in major flux, then it may be worth it to overwrite your existing entities (especially if you haven't modified them), but most of the time you will want to simply edit your existing entities as opposed to regenerate them.
Hope this helps,
Matty wrote on Wed, 09 December 2009 05:58
> Hi Folks,
> iam totally new to Dali or Eclipse with JPA, and iam very excited about the possiblity to generate Entity-Classes from my existing DB-Schema.
> Everything works fine. But i can't find out how to "resync" changes from my DB-Schema to the Java-Entity. Is there any hidden feature for this?
> How do you handle it, if you changed something in the Entity Class (for example add @NamedQueryies ) and resync afterwards?
> If i try to generate the Entities from Tables again then Eclipse asks to overwrite the Entity-Class, but i dont want to loose my changes.
> Any ideas to this scenario? I believe iam not the only one who make manual changes.
> Thanks in Advance for any hints and apologise my english, its not my mothers tongue.
Powered by FUDForum
. Page generated in 0.08534 seconds