0 Replies Latest reply on Sep 25, 2006 4:57 PM by vrubba

    Changing the scope of a destination that used HibernateAssembler

    vrubba
      Now after playing with this for quite some time, it kinda started to make sense.

      I have a unique situation where I need to point the application to different databases based on the user.

      I use a remote object call over rtmp to authenticate my users and then set a FlexSession variable to their specific db connection.url.

      I then want to be able to retrieve this attribute from within my HibernateAssembler during Initialize().

      What I've done so far: I had to nuke the <server> section from my destination, change the scope to Session and then roll my own version of the Assembler, since the one out of the box is hardcoded to retrieve certain values from <server> properties. My destinations have been renamed so they have the same name as my hibernate entities - default behaviour - and I set caching and allow-hql within the HibernateType class.

      After I create the hibernate configuration in HibernateAssembler.Initialize() I run this line:
      configuration.setProperty("hibernate.connection.url", connString.toString()); //connString = flexsession variable set on login

      Now this *appears* to work. However I am wondering whether or not this approach of using FlexSession is going to be robust enough in the long term. Also, I am wondering whether I am hitting a tack with a sledgehammer here... perhaps there is a much simpler solution? I would love to hear it!