Some blog my website could claim to be without the possibility to leave comments here. It took a lot of work because – as usual – I decided to take the long way around to getting it done.
Modeling the comments was relatively easy using JPA annotations and Hibernate. It was also easy to get a form on the site so that information could be input. The thing is, I wanted to be able to moderate the comments to prevent any dissent. Only kidding! I wanted to prevent spammers, idiots and pr0n peddlers from making me crazy with shitty comments.
That‘s where it started to get involved and time-consuming. I ended up implementing a CRUD scaffolding system for SeemoreJ so I could manage any data I wanted. Though, it was rather more of an academic pursuit rather than a practical one – just to see if it could be done (or, more accurately, whether I could do it). I'm happy to be corrected but – as far as I am aware – the only other dynamic scaffolding available in a Java web framework is Grails.
I‘ll produce a proper write up of the code but here‘s a quick taster in the meantime.
public CommentsController() {
super(Comment.class, Long.class);
}
}
The code above is all that is required to produce a fully functional CRUD application. At the moment it only supports Hibernate entities, but generic JPA support shouldn‘t be too difficult. Also, it doesn‘t allow one to manage relationships with other entities but that‘s not too much more work.
No time for any more. I have plenty of work to tidy up SeemoreJ so I can get the first public release available. Watch this space!
Oh and please leave comments! :-)
First published on Jan 6, 2009. Last updated on: Jan 7, 2009.