ColdFusion 9 ORM and having an entity extend another to persist
Tags: Coldfusion, CFORM
I spent the day trying to get my head around mapping and older Application to the new ORM in ColdFusion 9, to only be very disillusioned again with CF-ORM.
I really hope that this problem will be addressed at some stage, as it would be very beneficial to some applications out there.
Now don't get me wrong with this, as first you can extend another component and use methods in that component. But what you can't do natively is have the properties of the extended component persist into the table.
Lets have a look in more detail what I am trying to do. I have 2 directories that I have labelled domains/base and domains/entities.
In the base directory I have created all the entities that will contain all the base properties of a given table, and then in the entities I have further directories and the and entity in each that will extend that base.
That may not make sense to most, so lets break that down to what I am trying to achieve. In an existing application I am working with the code runs across n databases, and some of these tables may or may not exist in the database. That was solved by following the convention that I devised with the directories, but what I could not solve was that some of these tables can also have different columns (entity properties) in that table in a different database as well.
So the solution was to try to achieve this by the convention in place. The thing is that the entity works, it can be created to with the different properties as expected. But what doesn't work is the mapping to hibernate.
No matter what I try I am not able to do this by the convention that I have in place, but after reading the docs even further it seems it can be done with the generated hbmxml files. Except these files aren't generated at all.
So that leaves me having to modify to separate places for changes to the entity, which is not an ideal situation and is open to more heartaches than it was trying to solve.
So I am not impressed that this is not achievable.
-
Andy - in your ORM settings add savemapping=true to the struct. The .hbxml files will be dropped in the same folder as your cfcs.
# Posted By Steve Rittler | 3/13/10 9:13 AM -
Steve - Thanks for the reply, when I said that the mapping is not created. I actually should have said that I already have tried that to modify the hbmxml file.
# Posted By Andrew Scott | 3/13/10 6:51 PM



TweetBacks