Tuesday, November 3, 2009

Bye Bye Linux

Ok, i cannot handle it anymore... It just takes too much time and effort to make some specific things working correctly!
I believe it is cool system, but not for software development using latest technologies like GWT.
I am switching back to Windows. I will miss Ubuntu and bash... Especially bash!

Thursday, September 17, 2009

Hibernate, versioning and DRY

Recently i was working on a project, where we were using "tracked" objects. This is a kind of versioning mechanism, implemented on DB level using triggers.

When i was starting to implement tracked objects in Hibernate, i've noticed that there are few properties that every tracked object has:
  • T_PK - primary key in table with versions
  • T_START - starting moment for transcation
  • T_END - end moment for transcation
The idea was to add this stuff to some other Hibernate entity to not have it duplicated in every mapping file. I remembered that <class> element could have "abstract" attribute set to true, so i can just extend it and be cool. Not really :)

There are four types of inheritance relation used in Hibernate, well-described here:
http://simsonlive.wordpress.com/2008/03/09/how-inheritance-works-in-hibernate/
http://javavibes.wordpress.com/2009/06/22/hibernate-inheritance/
  1. One table per concrete class
    That sounded good at first glance, but it allows the reusing only on java side, and i don't care about it too much because it is auto generated.
  2. One table per concrete class with union-subclass mapping
    In this case all versed objects should be a <union-subclass>, plus they have to be in one hibernate mapping file with the parent class.
    Not sure if it is ok... It may produce what i want, but i have all the versed objects in one place. This option is supposed to be used for polymorphic queries, and i want to just have all the fields in one place.
  3. One table per class hierarchy
    It is just not suitable at all, we have a bunch of tables instead of one.
  4. Implicit polymorphism
    Again, not suitable because java objects are generated.
After i took a look into the possibility of using one aggregated object for versioning
http://docs.jboss.org/hibernate/stable/core/reference/en/html/components.html 
Got a few problems here also:
  • ID couldn't be a part of aggregated object
  • It is copy-pasting too
  • hbm2java produces strange things when component is in place (maybe i was doing something wrong, i haven't dig deep there)
Then i searched the Hibernate forum for topics about simple reusing of mappings, and i've found something interesting:
Turns out copy-pasting all these versioning information is the best way to do things? Looks like this.

Friday, August 28, 2009

VMware player - the ultimate hotkey destroyer

I've encountered very annoying issue while using VMware player - all my Linux hotkeys were suddenly dropped out when vmplayer was launched. I couldn't even open a new tab in Firefox until i execute setxkbmap command.
After searching on google and investigating different options for virtual machine i've found combination that particially solved problem.
<Win XP>.vmx file
  • isolation.tools.dnd.disable = "TRUE"
  • isolation.tools.copy.disable = "TRUE"
  • isolation.tools.paste.disable = "TRUE"
  • mks.keyboardFilter = "off"
Now it seems to work... but i cannot copy from host OS to hosted OS, which is kind of a pity :)