• Home
  • RSS Feed
  • Log in

Archive for the ‘Hibernate’ Category

Older Entries Newer Entries

Hibernate and Multi-Threading
Posted by Maarten Winkels late at night: February 7th, 2009

When you use Hibernate for ORM and come across some functionality that requires multi threading, there are many pitfalls that might make life difficult for you. This blog will focus on those problems. Conclusion is: don't use hibernate managed objects in multiple threads.
(more...)

  • Share/Bookmark

Tags: lazy initialization exception, lost update, multi threading, transaction
Filed under Hibernate | 7 Comments »

Clean Code vs. Implementation Patterns
Posted by Vincent Partington in the late evening: January 26th, 2009

I've just read Robert C. Martin's Clean Code and Kent Beck's Implementation Patterns back to back. I actually picked up Clean Code first because my colleagues were raving about it. But then Robert Martin's book quotes from Kent Beck's book on the third page of the first chapter already, and disagrees with the quote, so I decided it'd be fun to read Implementation Patterns too. :-)
(more...)

  • Share/Bookmark

Filed under Architecture, Hibernate, Java, Testing | 11 Comments »

Maybe annotations aren’t that bad after all
Posted by Vincent Partington at around evening time: January 19th, 2009

Two years ago I blogged about annotations and that I considered them to be A Bad Thing. It seems I will have to eat my words. I am actually using them to the hilt in my current project.

We use JPA and specific Hibernate annotations on our entities. See for example these annotations on a field:
@OneToMany(mappedBy = "changePlan", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@org.hibernate.annotations.Sort(type = org.hibernate.annotations.SortType.COMPARATOR,
    comparator = PositionableComparator.class)
private SortedSet steps = new TreeSet(new PositionableComparator());

(more...)

  • Share/Bookmark

Filed under Hibernate, Java, Spring | 4 Comments »

Sorting and pagination with Hibernate Criteria – How it can go wrong with joins
Posted by Jeroen van Wilgenburg mid-morning: December 11th, 2008

Lately I ran into an annoying problem with Hibernate. I tried to do pagination on a query result which was doing an SQL-JOIN under the hood. The query before paging returned about 100 results. When I turned on paging (with 20 results per page) all the pages had less than 20 results!
The reason for this is that with a JOIN there can be duplicate results and those results are filtered out after pagination is done. In this blog I will explain how to solve those problems and it also a cleaner way to build your Criteria queries.
(more...)

  • Share/Bookmark

Tags: criteria, pagination
Filed under Hibernate, Java | 9 Comments »

Spicefactory – Part 2: Add Pimento to your Grails dish!
Posted by Maarten Winkels terribly early in the morning: December 11th, 2008

This second part on Spicefactory will delve into the details of writing a Grails plug-in for this framework. Be prepared to read a lot of code!

(more...)

  • Share/Bookmark

Tags: AS3 EntityManager, grails-flex-webtier plug-in, grails-spicefactory plug-in, JPA EntityManager, pimento, spicefactory
Filed under Flex, Grails, Hibernate | No Comments »

Confusing Hibernate Configuration Syntax
Posted by Maarten Winkels in the early afternoon: October 21st, 2008

Today I spend some hours trying to fix a hibernate bug in our application. I changed the configuration just a little and it seemed that Hibernate was unable to handle this. I'd even found a bug report in Hibernate JIRA that described the same situation. I was on the brink of downloading the sources and trying to fix the problem in Hibernate... turns out there was an error in our configuration! This is to say, the model we wanted to configure could be configured in a non straight forward way. Apparently from the JIRA issue there are more people that find it difficult to come up with the correct configuration for this situation. Let me try to help them with a little example.

(more...)

  • Share/Bookmark

Tags: bi-directional association on join table, ConstraintViolationException, SQLException Column not found, SQLGrammarException could not load an entity
Filed under Hibernate, Java | No Comments »

Configuring Hibernate and Spring for JTA
Posted by Maarten Winkels mid-afternoon: July 18th, 2008

Spring is a great framework for dependency injection and it comes with a lot of support classes and utilities for all kind of things. Hibernate is a persistence service with a lot of useful features, that is relatively easy to use. Configuring both frameworks is not always easy. Configuring them together is sometimes hard and it is easy to make mistakes.

This blog addresses a problem in a configuration that is fairly common: use Spring for transaction management on top of a JTA provider and use Hibernate for persistence. Transaction demarcation is easy and declarative with Spring. The problem is that Hibernate sometimes needs to detect the current transaction and this needs to be configured. This leads to hard to detect bugs in applications that rely on auto flushing.
(more...)

  • Share/Bookmark

Tags: auto flush, Hibernate, JTA, Spring
Filed under Hibernate, JTA, Spring | 4 Comments »

Back to the 80’s…
Posted by Twan van Enckevort in the early afternoon: July 15th, 2008

Overview of the CTA display and the PC that runs the socket server allowing tcp/ip access to the display

One of the challenges we are facing in our project is connecting antique display devices to the brand new travel information system we are building. If you have traveled by train in the Netherlands you are familiar with them: large displays with booklets for destinations and departure times. It contains a number of booklets which are controlled by a stepper engine. The devices are called CTA's, were developed in the eighties and are a solid piece of engineering. Behind the track indicator, which doubles as a door, is a temperature control for the heating, a power socket for connecting electrical equipment, a telephone socket and a connector for testing. Oh yes, did I mention it is heavy?

(more...)

  • Share/Bookmark

Filed under Agile, Hibernate, Javascript, Project Management, Testing | 2 Comments »

Querying associations in Grails with HQL, Criteria and HibernateCriteriaBuilder
Posted by Erik Pragt mid-morning: June 4th, 2008

A thing I was playing with today was many-to-many relationships in Grails to create a Tag Cloud. To create a Tag Cloud, I must have a set of key/value pairs, each with a label and a value of the label, which could look like this:

['Java': 5, 'Grails': 16, 'Groovy': 12]

But to query this, I need to query a many to many relationship and produce the above result. This blog will describe how to do this with HQL, Criteria and the HibernateCriteriaBuilder.
(more...)

  • Share/Bookmark

Filed under Grails, Groovy, Hibernate, Java | 6 Comments »

Advanced Hibernate: Proxy Pitfalls
Posted by Maarten Winkels in the late evening: March 8th, 2008

Most programmers come into contact with Hibernate proxies when they face the ominous LazyInitializationException. The bad taste is hard to wash away, but Proxies are a necessary “evil” when working with Hibernate. This article will dig into why proxies are important. It will also point out some pitfalls that occur often when working with proxies.
(more...)

  • Share/Bookmark

Filed under Hibernate | 14 Comments »

Older Entries Newer Entries
Deployment automation for Java application running on Websphere, WebLogic and JBoss

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India

Categories

  • Java (282)
  • Agile (109)
  • General (50)
  • Testing (42)
  • Performance (42)
  • Hibernate (36)
  • Scrum (33)
  • Podcast (31)
  • Architecture (31)
  • Spring (28)
  • SOA (24)
  • Maven (22)
  • Project Management (22)
  • Middleware (23)
    • Deployment (14)
  • Flex (17)
  • JPA (17)
  • Eclipse (15)
  • Xebia Labs (15)
  • Quality Assurance (14)

Tag Cloud

    XML qcon Seam esb Hibernate Grails Maven IntelliJ fitnesse Xebia Closures Agile Awareness Workshop Lean Architecture Spring Functional Programming Poppendieck Scrum Java product owner JavaOne SOA Agile Introduction to Agile Ajax Performance Semantic Web Testing Groovy Scala