Your second question

rsmith wrote:
> 
> Also, is there a way to not have a surrogate key for some tables, and use
> a business key instead?  I know this isn't the recommended approach, but I
> have a couple exception cases where I'd like to do this.
> 

Sculptor adds id to all persistent DomainObjects and assumes in the
generation phase that an id attribute exists. I think it is tricky to
support your request in a general manner, foreign keys etc, but if you have
a specific exception it might be possible, but that depends on what you
need.

Starting point...

1. Skip id attribute in the transformation for some DomainObjects. Use AOP
as I described for the first question.

around transformation::Transformation::modifyIdAttribute(DomainObject
domainObject) :
    if domainObject.name != "NoIdEntity" then ctx.proceed();

2. Adjust generation templates. Use AOP, add AROUND advices in
src/main/resources/templates/SpecialCases.xpt in your target project.

«AROUND templates::Hibernate::id FOR DomainObject»
    «IF getIdAttribute() == null -»
      <id />
    «ELSE -»
      «targetDef.proceed() »
    «ENDIF -»
«ENDAROUND»

Let me know if you need some adjustments to Sculptor to support your case.

/Patrik
-- 
View this message in context: 
http://www.nabble.com/-Sculptor--how-to-control-surrogate-key-name-tp18625411s17564p18658632.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

Reply via email to