SOFA TICKET #2
I am very busy now and sofa is taking some delay so maybe it’s time for you to give me some feedback about it. If you send me a mail next week i’ll get you a copy (’SOFA’ in the subject would be great). It’s not about finding some hard hidden bugs but more about features request and syntax improvement. There’s still a lots of things to do in it and some of the basics features are missing (like cascade delete) so don’t expect to find Hibernate 2 !
arnaud AT matsiya.com
SOFA ticket #1
Unlike hibernate or Rails’ ActiveRecord ORM Sofa isn’t an intrusive framework. Accessing a relational property won’t get you other things that what you’ve put into. Currently it’s possible to populate a property by setting “auto-fetch=’on’” or by doing a “fetch Object.property” in a load request. But we needed a way to do a “just in time” fetching. The best one we’ve found was to mount an object into the SofaManager so then we could execute a new opertation on it. Here’s an example :
private var user:User; var sofaManager:SofaManager = SofaSession.getSession(); // We load the user with id 1 user = sofaManager.createQuery("load User where User.id = :id") .setIntegerArgument("id", 1) .execute(); trace(user.pictures); // will output null //beacause we didn't set auto-fetch to 'on' user.pictures isn't set yet. //we mount the object and fetch its pictures user = sofaManager.mount(user) .createQuery("fetch User.pictures") .execute(); trace(user.pictures); // will output an ArrayCollection
This sample code is equivalent to :
user = sofaManager.createQuery("load User where User.id = :id;") .append("fetch User.pictures") .setIntegerArgument("id", 1) .execute();
SOFA is currently under hard development and we’re not able to give a release date yet.




