0

Let us say that I want to use Coldfusion's Hibernate ORM. But I don't want to write the CFC's for each object, I have a configuration file which details my schema.

I want to parse that configuration file and generate the ORM dynamically.


Or, what if I had some CFC's

  • Blogs.cfc
  • Tags.cfc

But the relationships are of a more "dynamic" nature. Is there any way to programmatically add my own property to relate Blogs and Tags?


These examples are simplistic to what I am trying to accomplish, but they are necessary first steps, and there doesn't seem to be anyone else asking these questions out there.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
Tyler Clendenin
  • 1,459
  • 1
  • 12
  • 25

1 Answers1

1

I wrote a CFC that did database introspection and created my ORM CFC's for me. As far as making them "dynamic", that really depends on how dynamic. If you wanted them to be so fluid you could pass arguments and change the properties, that might work, but I don't think it would be efficient from a performance perspective. I'm also not sure it would work since ORM generates all your hibernate files once the application loads or ORMReload() is called. In other words CF works from those hibernate files in the background. The persistent CFC's are used as a map to generate those hibernate config files. At least, that's my understanding of how it works.

What you might want to do is develop an interface to work directly with Hibernate, which might allow you to make your ORM entities truly "dynamic". If that's what you're looking to do then you should find this link helpful.

JamesRLamar
  • 908
  • 1
  • 11
  • 22
  • is that cfc you created something you could post? @jamesRLamar Thanks! – timbrown Jul 16 '15 at 20:38
  • 1
    @timbrown, I just posted the whole framework on Github. No warranties. Very little documentation. Use at your own risk, but I put a lot of work into it so feel free to use whatever you like. https://github.com/JamesRLamar/axstron – JamesRLamar Jul 17 '15 at 00:34