Thanks, I used the latest 1.5.0 snapshot code and it works great. I'm getting up to speed on oAW/Sculptor, and had a couple more things I was trying to find how to do:
- The foreign key reference columns are named based on the referred-to table (e.g. ADDRESS). Can I customize this to be the same column name as the primary key of the referred-to table (ADDRESS_ID in my example). - Is there a way I can customize the names of the CREATEDDATE, CREATEDBY, etc column names? - For entities that don't have a business key (such as address), Sculptor generates the UUID column/attribute. Is there a way I can name this <table name>_ID instead of UUID. For entities with a business key, the below works great. Thanks again --Ron Patrik Nordwall wrote: > > Your first question: > > rsmith wrote: >> >> Is there a way I can specify what the name of the surrogate key column >> should be? >> I have to follow a standard where the name would be <table name>_ID. >> e.g. ADDRESS_ID instead of ID. Can I do this with Sculptor? >> > > It is possible to do this using the excellent AOP facilitates of oAW. Do > like this: > 1. Add an extension advice file in your target project, > location: src/main/resources/extensions/SpecialCases.ext > content: > import sculptormetamodel; > > extension extensions::helper; > extension extensions::dbhelper; > > around transformation::Transformation::modifyDatabaseNames(DomainObject > domainObject) : > ctx.proceed() -> > > domainObject.getIdAttribute().setDatabaseColumn(domainObject.getDatabaseName() > + "_ID"); > > 2. In workflow.oaw in your target project you need to add the following: > <component adviceTarget="modelTransformation" > class="oaw.xtend.XtendAdvice"> > <extensionAdvice > value="extensions::SpecialCases" /> > </component> > > > That's all! However, I found a bug in the DDL generation. It uses a > hardcoded ID in the foreign key constraints ( > http://www.fornax-platform.org/tracker/browse/CSC-224 CSC-224 ). I have > fixed this, but it is not deployed yet. > > I will look at your second question later. > > /Patrik > -- View this message in context: http://www.nabble.com/-Sculptor--how-to-control-surrogate-key-name-tp18625411s17564p18844315.html Sent from the Fornax-Platform mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Fornax-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fornax-developer
