Developer blog

Wednesday, July 27, 2005

Hibernate issue

Yesterday I have work with hibernate and realted stuff. I worked with some Entety class created property, that was defined by some formula. Something like this

<property name="propertName" formula="'test'">


So as you can see property is some kind of constant in this example. After this I have tried to create Criteria to SELECT some objects of this class from database, and order it by my shiny new property, with something like this

resultCrit.addOrder(Order.asc("propertyName"));

And I have got error from postgresql about ORDER BY clause. After looking in what kind of SQL query
hibernate tring to create, I have find out that it tring to execute something like this

SELECT field1, field2, 'test' as t FROM table_name ORDER BY 'test'

It absolutly obvious that insted of 'test' hibernate should use t in ORDER BY clause. Looks like bug for me.

Saturday, July 23, 2005

Postgresql issue

Working with MySQL about two years already, I believed that if you what to count all fields in some table, you should do something like this

SELECT count(*) FROM table_name


But yesteday I found out that it does not work for Postgresql. It often backs you error, something about group by. So solution is to do it in this way

SELECT DISTINCT count(*) FROM table_name

Thursday, July 14, 2005

Job, finaly!

Now I am working here

Saturday, July 02, 2005

Test Task

Communicating Applets in different ClassLoaders using String intern and Java synchronization primitives

In Java there is a documented security problem that two applets could communicate with each other even if they are on different pages and even in different classloaders.

It is believed that this could be done using String pool (String.intern()) and Java synchronization primitives.

So task is to create classes similar to java.net Socket and ServerSocket classes that are able to listen for specific string prefix, create connection and transfer data.


The specifiable parameters for server string socket are:
> String prefix of listening socket
> Width of the channel

It is required to create two applets that allow entering prefix and channel width for server applet and name of server socket for client applet. After establishing connections these applets should be able to exchange text messages to each other.


my solution
If tou want to get source code, tou should ask me.