Silicon Valley Blog for early adopters, technology geeks, RSS addicts and Mac freaks.
(May also occasionally contain some TiVo, media, sports and politics...)
Hibernate saveOrUpdate trap for web developers and StaleStateException
Summary: Hibernate users should be aware of saveOrUpdate method if they continue to use the same persistent object even if a transaction failed at some point.
Details:
Suppose you have a persistent object bound to your web(like JSF) views. Entered some data (which will lead to a db ConstraintViolationException) and tried to save it (at your DAO service) by using saveOrUpdate method. As we expected, it will throw a ConstraintViolationException and you'll rollback the transaction.
Then, go back to the entry page, correct the wrong field value at the same object, and try to save it again. You'll get a StaleStateException since saveOrUpdate method assigned identifier values automatically to your new object when you attempt to save it first. Later, when the save operation failed, it didn't roll back your object's state to its initial state. The summary of the flow causing this error is as below;
Mechanism Studios is an independent venture showcasing outstanding electronic and mix-media art and culture. Browse our site for a look at emerging indie graphic artist around the web. With the advent of new technologies comes a new approach to art and media. This process and the art and media that result from it are what Mechanism Studios is all about.
SyntaxHighlighter is here to help a developer/coder to post code snippets online with ease and have it look pretty. It's 100% Java Script based and it doesn't care what you have on your server.
Finally a useful article on eclipse.ini memory settings: "Many users seem to have problems with running out of memory when using Eclipse 3.2 in combination with additonal plugins such as those from JBoss Tools or even Eclipse WTP."
Sie wollen die Programmiersprache Java lernen? Dann sind Sie hier genau richtig! Im Java Blog Buch werden nach und nach mehr oder weniger aufeinander aufbauende Lektionen veröffentlicht, so dass am Ende eine Art Buch zur Java Programmierung entsteht. Navigieren Sie sich einfach durch das Kapitelverzeichnis auf der linken Seite oder durchstöbern Sie das Inhaltsverzeichnis!
Gerne dürfen Sie auch interessante Themen vorschlagen, über welche wir dann ggf. bloggen werden.
Aber jetzt wünsche ich Ihnen viel Spaß beim Java lernen!
Ps.: Sollten Sie sich dazu berufen fühlen, einen Beitrag zu diesem Werk zu leisten oder gleich als Autor einzusteigen, so nehmen Sie doch einfach Kontakt zu uns auf.
Hibernate Annotations is my preferred way to map my entity classes, since they don't require any external file (thus keeping mapping info in your Java files), is fully integrated with all Hibernate mapping capabilities and Hibernate documentation encourages us to use this kind of configuration because it's more efficient.
Annotation driven mapping in Hibernate uses the standard JPA API annotations and introduce some specific extensions to deal with some Hibernate features. You can find a full reference in the official documentation.
Spring, JPA, and JTA with Hibernate and JOTM
2007-04-24 20:35
have been struggling for a couple of hours today to modify a Spring JPA configuration with a single datasource, Hibernate as the JPA provider and the JpaTransactionManager to a configuration with two XA datasources, Hibernate as the JPA provider, and the JtaTransactionManager with JOTM as the standalone JTA provider.
since the Spring and Hibernate reference manual and Javadoc documentation merely contain a number of hints on how to configure JPA with a JTA transaction manager and others are struggling as well i decided to post how i finally got it to work.
I'm Kirill Grouchnikov and this blog is about user interfaces, imaging and related topics. Half the time i spend writing the code i create new bugs, and the rest i try to chase and fix them without creating too many new ones. For now it seems to be a lost battle.
Java provides a neat way to carry out long lasting jobs without have to worry about threads and hanging the application. It's called SwingWorker. It's not the latest thing on Earth (released with Java 1.6) and you may have already read about it. What I never came across was a practical example of the swing worker.
# store status from GTalk, Yahoo messenger
# send posts from Gtalk, Yahoo as Instant Message
# use it to bookmark URLs
# or write small 'to the point' posts
# threaded discussions on a post
# get closer to existing friends
# and get to know friends of friends
sux0r 2.0 is an extendable content management system (CMS) built around the principles of Naive Bayesian probabilistic content.
Naive Bayesian Categorization is the ouija board of mathematics. Known for being good at filtering junk mail, the Naive Bayesian algorithm can categorize anything so long as there are coherent reference texts to work from. For example, categorizing documents in relation to a vector of political manifestos, or religious holy books, make for a neat trick. More subjective magic 8-ball categories could be "good vs. bad" or company press releases in relation to stock market prices.
In addition to being a blog, RSS aggregator, bookmark repository, and photo publishing platform, sux0r 2.0 allows users to maintain multiple lists of Naive Bayesian categories. These category lists, called vectors, can be shared with other users. This allows a group of trusted friends to share, train, and use sux0r together.