Unexpected database connection problem. Hibernate broken pipe.
While using Hibernate, several times I faced the same database communication problem: for some reason after long inactivity time connection was closed. Each time that happens it takes some my time to remember the solution. So this post is more like a note for myself, but also can be helpful for those who can find it in Internet.
»
- Add new comment
- Read more
- 578 reads
- Russian
Hibernate. Count queries without HQL
I like to use Criteria class for making database queries. Its easy to use and easy to understand, much better then HQL queries. For example:
@SuppressWarnings("unchecked")
public List<LogAdd> findAddLogs(Long minLogID) {
Criteria criteria = session.createCriteria(LogAdd.class);
criteria.add(Restrictions.gt("id", minLogID));
criteria.addOrder(Order.asc("date"));
return criteria.list();
}
Previously I had to use HQL only for writing 'count' type queries. Because just trying to get collection size mean to load all elements into memory from database and only then count them. Of course such kind of code isn't acceptable.
»
- Add new comment
- Read more
- 935 reads
- Russian
13949712720901ForOSX
»
- Add new comment
- 1323 reads
Installing Apache Tomcat 5.5 on Debian 4 (Etch) Linux
If you need to install and start Apache Tomcat quickly, probably this article can help you.
1) Sun JDK 5 need to be installed. It can be installed from Debian repository with unstable software
Add to /etc/apt/sources.list following lines (if not present yet):
# for sun-java packages in unstable deb http://ftp.debian.org/debian/ unstable non-free deb-src http://ftp.debian.org/debian/ unstable non-free
Update apt cache:
koba@alpha:~$ sudo apt-get update
»
- 2 comments
- Read more
- 1902 reads
- Russian
Java Application Process Name in Mac OS X
I have found that several of my Java applications have same process name on Mac OS X. JavaApplicationStub utility is usually used for launching java applications on mac os and as the result there are several processes named 'JavaApplicationStub' in Activity Monitor shown.
I have created simple HelloWorld application to reproduce this problem. And I was really surprised when saw that it's process name was correct!
»
- Add new comment
- Read more
- 1027 reads
- Russian
New project with maven2. Part 2 (wizard)
As was discussed in one previous post I have changed the script which became a wizard. This improvement makes the application generation process easier for the user. It also provided additionally functionality.
After answering on several questions and specifying a required type of application a project will be generated. Just run Eclipse IDE and import it into your workspace.
»
- Add new comment
- Read more
- 1006 reads
- Russian
Java application menu in system tray
I got the task to implement system tray menu for java desktop application. After some research I found several ways to finish my task:
- java 6
- java desktop components integraion library (jdic)
- eclipse swt
I have only the one biggest requirement for new application. It should support all most popular operating systems (win, linux and mac os). Java 6 has no support on mac os x. For some reason I was thinking that Jdic has no support on Mac OS X too (now I know that I was wrong). Starting from 3.3 version, SWT started supporting all main operation systems. And as the result SWT became my one and only choice.
»
- Add new comment
- Read more
- 1711 reads
- Russian
You may make up a free wallpaper, but still it will be hard to get it
Have you ever try’s to look for free wallpapers? Looks like quite easy. Just google for ‘free wallpapers’ and get a lot of results. But, when I try’s to do this for myself I found several problems. So I decided to review 30-40 sites and select the best ones.
First of all, what the most common problems I have found? Look next:
»
- 3 comments
- Read more
- 3094 reads
New project with maven (small help note)
Once in a while I need to make small java applications maybe for testing some library, maybe as helper applications. As for me the fastest way to do this, is use maven archetype mechanism. But new project creation command not very user friendly since it required several parameters that you need to remember (‘-DarchetypeGroupId’ or ‘-DgroupId’). As solution you can make small help script and put it into your projects folder.
As quick solution I make small shell script (new_project.sh) that can be used for fast start:
»
- Add new comment
- Read more
- 1503 reads
- Russian
How to build skin for Maven 2 Site Plugin
Maven is open source java build manager from Apache software foundation. It has a lot of interesting features including Project Object Model (POM) and extensible process Plugin framework.
One of standard and commonly used plugins is maven-site-plugin. It provides way to generate project documentation based on POM in form of web site. Starting from version 2.0-beta-5 it’s possible to create your own design (skin) for generated web site.
This blog record must be interesting for developers who already familiar with maven 2 and use it for development. I will try to describe basic steps how to make your own custom skin.
»
- 2 comments
- Read more
- 3174 reads
- Russian