source: mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/mapping.vm @ 8393

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/mapping.vm@8393
Revision 8393, 503 bytes checked in by mnagni, 7 years ago (diff)

Stable release 0.1.0

  • Property svn:executable set to *
Line 
1## mapping.vm
2#macro( beforeInsertListener $tableModel)
3#set ($tm = $tableModel.associatedClass.name.toLowerCase())
4def ${tableModel.associatedClass.name}_before_insert_listener(mapper, connection, target):
5${tab}if (target.${tm}_id is None):
6${tab}${tab}target.${tm}_id = next_id(connection, '${tm}_id_seq')
7#end
8
9#if(!$tableModel.associatedClass.name.equals('EARootClass'))
10${tab}mapper($tableModel.associatedClass.name, #tableName($tableModel)
11, properties  = {#relationColumns($tableModel)})
12
13#end
Note: See TracBrowser for help on using the repository browser.