-- $Id: GenerateHibernateMapping.atl 4971 2006-06-14 17:40:02Z dwagelaa $ -- Generates a test hibernate mapping 3.0 model from a uml2 model module UML2HBM_3; create OUT : HBM from IN : UML2; rule M2M { from i : UML2!Model to o : HBM!HibernateMappingType ( class <- UML2!Class->allInstances() ), dr : HBM!DocumentRoot ( hibernateMapping <- o ) } rule Class { from s : UML2!Class ( s.nestedClassifier->exists(e|e.name='BPersistent') ) to c : HBM!ClassType ( name <- s.package.name.debug('package_name:') + '/' + s.name.debug('Class name:'), table <- s.name->toUpper(), id <- get_id_object, property <- get_prop_1_object, property <- get_prop_2_object, set <- get_set_object ), get_id_object : HBM!IdType ( name <- 'id', column1 <- s.name->toUpper() + '_ID', generator <- get_gen_object ), get_gen_object : HBM!GeneratorType ( class <- 'native' ), get_prop_1_object : HBM!PropertyType ( column1 <- s.name->toUpper() + '_DATE', name <- 'date', type1 <- 'timestamp' ), get_prop_2_object : HBM!PropertyType ( name <- 'title' ), get_set_object : HBM!SetType ( name <- 'participants', table <- 'PERSON_EVENT', inverse <- "#true", key <- get_key_object, manyToMany <- get_manyToMany_object ), -- get_inverse_object : HBM!InverseType1 ( -- value <- 'true' -- ), get_key_object : HBM!KeyType ( column1 <- 'EVENT_ID' ), get_manyToMany_object : HBM!ManyToManyType ( column1 <- 'PERSON_ID', class <- s.package.name + '/' + s.name ) }