6/03/2010

Mirage supports stored procedure/function

The next version of Mirage will support stored procedure/function. We added new methods to call them to SqlManager in the SVN trunk.

Here is an example to call stored function in Mirage:

// Creates parameter object which give to stored function
GetCountParam param = new GetCountParam();
param.deptId = 1;
...
// Calls a stored function and get a result value.
Long count = sqlManager.call(Long.class, "get_emp_count", param);

Fields of the parameter class has annotation such as @In, @Out, @InOut and @ResultSet. These annotations mean parameter type.

If the function returns ResultSet, use SqlManager#callForList() instead of SqlManager#call().

Please wait for the next release of Mirage!

2 件のコメント:

Adrian A. さんのコメント...

Interesting improvement, but isn't this a "mined field"? Stored procedures are very different from DB to DB and require different handling in Java too, thus the requirement to constantly add "not supported yet" DBs, and also to install and test on such a big variety of DBs?

IMHO far more users would benefit from support for Relationships: they're DB independent, and any application with more than a few tables requires them. However, I'm not sure yet how to implement them in Mirage :( (otherwise I would have sent you a patch for review).

Naoki Takezoe さんのコメント...

We tested stored procedure support with Oracle, PostgreSQL, MySQL, SQL Server, H2 and DB2.

I'm careful about relationship support because entity based operation is not main feature of Mirage. I want to make it in the future version of Mirage. However I want to consider about how to make it in Mirage well.