Spring’s IoC is wonderful, and annotating classes for auto-configuration and wiring is exceptionally useful. But when you have a primitive value to set on an object, it can be tedious to manually define the bean in your context.xml. Here is an example: Now, I could set the host as a bean in the context.xml: But, […]
More Domain Entities
Domain entities, the counter to transfer objects, embrace the idea that objects can be smarter than a post-it. Through domain-driven design, these objects understand that they have properties, and can ease the burden on the rest of an application by performing some of the behavior itself. This also reduces feature envy (see more on code […]
Events for EXT-JS
There are many events in EXT-JS to which you can ascribe listeners to do some neat things. But to which event should you attach functionality? Well, some are pretty clear, such as the select event on the selection model of a grid, allowing you to do things with a row selection. Or using mouseover to […]
Creating Displayable Text
Working on cycling through the fields of an object, and programmatically building a user friendly display text for each. To simplify my life, I’m using reflection, and the following method to capitalize the field name, and insert spaces appropriately (for camel-case field names):
Getting Started with Hydra
AddThis recently released Hydra on the open source community, and with my proximity to this technology, I thought it would be a wonderful winter adventure to peruse the code base. After cloning the project from GitHub, I required updating/adding Java 7 to my Eclipse environment. It was a bit more tedious than I expected. I […]
Formatted Number Column in EXT-JS Grid
The standard display of a number in a grid panel contains no delimiters or decimals. If you want to add one, you can apply a renderer to the column. [code language=”javascript”] { header : ‘Total Population’, dataIndex : ‘population’, width:70, renderer : function() { return Ext.util.Format.numberRenderer(‘0,000’); } } [/code] I prefer to externalize this to […]
Quick Assessment of Hibernate Efficiency
Out of curiosity, I ran a test to compare the speed at which Hibernate completes executing HQL vs SQL vs Criteria selections. The results are pretty clear. Running the selection a thousand times:HQL Query executed in 1764 msSQL Query executed in 486 msCriteria executed in 683 ms The results were similar for other total executions. […]
Adding the Emergency Warning Smart Layer | AddThis Blog
Adding the Emergency Warning Smart Layer | AddThis Blog.
Storing Enum in Hibernate 4
I recently faced a conundrum in that I wanted to use an enum to represent a value saved through Hibernate to a database. I didn’t want to store the name of the enum, rather a discriminator bound as a property of the enum. For example: In this situation, I want the status stored as an […]
Multi-Table Entity in Hibernate
Most entities of mine refer to a single table. But when an entity looks at more than one table to collect its attributes, Hibernate provides a handy annotation for binding in a second table — @SecondaryTable.
