Monday, September 13, 2010

Hibernate Named Native SQL Queries mapping to POJO in xml

Spent sometime looking for a way to create named in the orm.xml. I would have ranted about why every single example I had related to annotations, but that's already been covered sufficiently here or even why they all related to returning entity results when all you need sometimes is a simple POJO. This had me yearning back to the good old days of iBatis.

That goes into the orm.xml.

FYI, I was using hibernate 3.2.x, with the orm_1_0.xsd. ResultTransformers to do the quick POJO thing are only available when using Hibernate raw i.e. not using JPA. A good example is available here.

Sunday, September 12, 2010

IceScrum2 on AWS Micro instances

It's been a while since my last post. I've been under the pump at work and job hunting as well. The announcement from AWS this week about Micro-Instances were too much of a temptation for me. A $54 yearly reservation cost works out to $9.61 reservation cost per month and $5.11 usage at $0.007/hr at 730.5 hours on average in a month. A member of the AWS user group compared it to about 4 Big macs a month at US$ 3.73. Being vegetarian I'd prefer to compare it to about 4 cups of coffee per month.

So, what to do with this new found power? I'm moving some of my development environment online. At the moment that includes:
  • A JBoss 4.2.2 staging server
  • IceScrum 2
  • Hudson integration server
I've previously covered how to get started with AWS for J2EE servers. However, there are some pitfalls using Micro Instances. First, you can only boot from EBS. This may or may not be a good thing. On the plus, your data will always be persisted regardless of shutting down the server. The main negative is the additional cost of the EBS. I'll put it at another cup of coffee a month. Second, I'm migrating my existing IceScrum instance so I need to create an instance of Amazon RDS and export my MySql data to the RDS.

IceScrum2 requires 512MB to work properly (Seriously? 512MB for a simple web-app). The micro instance comes with 613MB each. Which doesn't leave much to throw around. Still, it works well. Next, I'll be putting up Hudson.

Saturday, September 4, 2010

ASP.NET ReportViewer control Dynamic reports with Object Data Source

I've been recently playing around with the built-in reporting control that ships with Visual Studio 2005+. At the time of writing, I'm working with Visual Studio 2008, with Microsoft.Reporting version 9.0. There aren't that many tutorials I found on the web for creating dynamic reports using Object Data Sources. For the uninitiated, an object data source is simply a strongly typed collection of objects with pre-defined properties. Visual Studio should pick up any classes with a method returning a strongly typed list of the objects.

Once you've got that bit sorted, now how to load the data source dynamically...

That's it. All sorted. Clear the data source from the report every time you want to regenerate the report.