tag:blogger.com,1999:blog-21102333.post7302303958989164079..comments2023-07-03T07:20:48.024-07:00Comments on Joe's Bit Bucket: State Pattern Persistence with HibernateJoehttp://www.blogger.com/profile/03602182138078986641noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-21102333.post-64131472487201015552008-09-15T01:55:00.000-07:002008-09-15T01:55:00.000-07:00i got something useful from your blog. thank ui got something useful from your blog. thank uAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-21102333.post-3500242416050639452008-08-21T01:44:00.000-07:002008-08-21T01:44:00.000-07:00org.hibernate.MappingException: Could not determin...org.hibernate.MappingException: Could not determine type for: OrderStateUserType<BR/><BR/>where i have put OrderStateUserType when i have complicate structure?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-21102333.post-14634023950398243772008-03-17T02:43:00.000-07:002008-03-17T02:43:00.000-07:00Hi Joe. I too found this a useful piece based on a...Hi Joe. I too found this a useful piece based on attempting to implement the State Pattern from the book with the nice girl on the cover :O)<BR/><BR/>The problem I could not crack was the fact the pattern actually instantiates the states within the entity and passes a 'this' reference in to each state constructor. <BR/><BR/>You provide an alternative which is to pass the entity reference (e.g. Customer) in to the action method (e.g activate). A nice touch but I wish to retain the original pattern structure since it is cleaner for my requirement: my different states sometimes transition the entity state bit sometimes do not require to do so.<BR/><BR/>I cannot see any way to use Hibernate UserType to retain the exact pattern implementation but let me know if you think otherwise.<BR/><BR/>Cheers, Camcsterhttps://www.blogger.com/profile/10750497941771334619noreply@blogger.comtag:blogger.com,1999:blog-21102333.post-83572842079579342292008-01-31T20:05:00.000-08:002008-01-31T20:05:00.000-08:00Thanks for dropping by my blog.> the EJB3 world is...Thanks for dropping by my blog.<BR/><BR/>> the EJB3 world is all a bit <BR/>> new to most of the<BR/>> development team <BR/><BR/>Hehe, just be thankful they don't have to learn EJB2!Joehttps://www.blogger.com/profile/03602182138078986641noreply@blogger.comtag:blogger.com,1999:blog-21102333.post-34914812776022491452008-01-31T13:09:00.000-08:002008-01-31T13:09:00.000-08:00hey Joe,I found this useful for some work I'd been...hey Joe,<BR/><BR/>I found this useful for some work I'd been doing today, so I thought<BR/>I'd leave a comment and say thanks. We were trying to persist a state<BR/>pattern implemented in a stateless way, with an abstract state class<BR/>being extended for multiple states. We have managed to argue our way<BR/>into restructuring the state model as a java 5 Enum that has methods<BR/>the state transition methods implemented like:<BR/><BR/>http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html<BR/><BR/>This appears to be persisted by hibernate as an integer, without the<BR/>need to create a user type, which we felt was a quicker and easier<BR/>solution, as the EJB3 world is all a bit new to most of the<BR/>development team.l0st3dhttps://www.blogger.com/profile/12311814571398717086noreply@blogger.com