Archives for: October 2005

Oct 31, 2005 : teaser and programmathon review, or, asynchronous blogging

thumbnail: route of trip out west First, a teaser! That's the route I took on my road trip out west this summer; each night's location is marked. I've been meaning for a very long time to blog about this. And perhaps this map will serve as motivation for me to do so fully.

Second, this weekend I did a 48 hour programmathon with a few friends. 9am Fri - 9am Sun, +1 hr for DST. I joined around 4pm, coding commenced around 5pm, we worked till 4am, slept till 10am, coded till 4am, slept till 8:30 and coded till 9:30. So about 30 hours of coding if my math is right. Most time was spent on getting jmonkeyengine (darn quaternions!) to work, and figuring out how to do trig again. It would be nice to start with a base (like our current game) if we do it again. By the end we got a reasonably playable asteroids game. We didn't spend time on packaging for distribution/download, so you can't see it now. Perhaps someday.. yeah right :-)

Oct 27, 2005 : 48-hour programmathon!

Friday 9am until Sunday 9am (49 hrs actually, due to daylight savings time) some friends are getting together to do some intense game programming. The idea comes from here and the ad-lib game development society. I'm not joining until after lunch friday, but it will still be quite an interesting time. Fun certainly!

We are allowed to sleep :-)

Oct 20, 2005 : Hibernate many-to-many relationships and Criteria queries

In hibernate, if you have a many-to-many relationship and you try to query it using a Criteria query you need to add:


If you don't, you get a full cartesian join between the primary object and the related objects. So you get all the combinations listed, not just one per object like you'd like.

For example, using annotations I have a class like this:

@Entity(access = AccessType.FIELD)
public class PrintOrder {
	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(table = @Table(name="tblPrintOrderProcesses"))
	protected List<PaperProcess> paperProcesses;


Then the Criteria Query should go something like this:

/** HibernateDaoSupport is a spring class and in this example is only relevant for the getSession() call */
public class MyDAOClass extends HibernateDaoSupport
	public .. some method() {
		Criteria criteria = getSession().createCriteria(PrintOrder.class);
		Property sort_property = Property.forName(sortField);
		Order sort_order;
		if (asc) {
			sort_order = sort_property.asc();
		} else {
			sort_order = sort_property.desc();
		List list = criteria.list();

So now you get only unique PrintOrders instead of multiple PrintOrders when the order has multiple paperProcesses.

<< Previous Page

<< Previous Page

<  October 2005  >
Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30




Syndicate this blog XML

powered by