|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Hibernate/SpringI have done a fair amount of reading today on the topic again and
developed a few simple classes to support my service, model, and dao architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The problem I am currently facing is I get a detached error when deleting an object and I get a null pointer exception in SessionImpl.java when I try to locate an object by its id. /* GenericDAO.java */ public T findById(Object id) { return(getEntityManager().find(clazz, id)); } public void delete(T entity) { getEntityManager().remove(entity); } Some posts I have seen say for the delete, you should use getReference() or merge() in order to get an association to the entity before you call the remove() method. I attempted to use the same type of logic with getReference() during the findById() and it failed. Am I missing something in my configuration with Hibernate/Spring with respect to the session factory or something that I need to revisit? It really seems as though I may have a missing component or a poor configuration somewhere. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Hibernate/Spring From what you are saying, I would have a look at the :
http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html My best guess is that this would fix your issue. If not, you probably have an issue with the way you are dealing with your entities. Denis. Chris Cranford a écrit : > I have done a fair amount of reading today on the topic again and > developed a few simple classes to support my service, model, and dao > architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The > problem I am currently facing is I get a detached error when deleting > an object and I get a null pointer exception in SessionImpl.java when > I try to locate an object by its id. > > /* GenericDAO.java */ > > public T findById(Object id) { > return(getEntityManager().find(clazz, id)); > } > > public void delete(T entity) { > getEntityManager().remove(entity); > } > > Some posts I have seen say for the delete, you should use > getReference() or merge() in order to get an association to the entity > before you call the remove() method. I attempted to use the same type > of logic with getReference() during the findById() and it failed. > > Am I missing something in my configuration with Hibernate/Spring with > respect to the session factory or something that I need to revisit? > It really seems as though I may have a missing component or a poor > configuration somewhere. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Hibernate/Springgood morning denis i sent chris a summary of working hibernate examples in Glassfish the getReference is a method from Ejb3Configuration the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl (and implements the sessions merge) whichever app server he will be implementing will have to be configured to serve his specific Bean as an EJBEntity.. Glassfish Users list would be more helpful i hope this clarifies Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Sat, 14 Nov 2009 08:45:46 -0500 > From: denis.cabasson@... > To: user@... > Subject: Re: Hibernate/Spring > > From what you are saying, I would have a look at the : > http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html > > My best guess is that this would fix your issue. If not, you probably > have an issue with the way you are dealing with your entities. > > Denis. > > > Chris Cranford a écrit : > > I have done a fair amount of reading today on the topic again and > > developed a few simple classes to support my service, model, and dao > > architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The > > problem I am currently facing is I get a detached error when deleting > > an object and I get a null pointer exception in SessionImpl.java when > > I try to locate an object by its id. > > > > /* GenericDAO.java */ > > > > public T findById(Object id) { > > return(getEntityManager().find(clazz, id)); > > } > > > > public void delete(T entity) { > > getEntityManager().remove(entity); > > } > > > > Some posts I have seen say for the delete, you should use > > getReference() or merge() in order to get an association to the entity > > before you call the remove() method. I attempted to use the same type > > of logic with getReference() during the findById() and it failed. > > > > Am I missing something in my configuration with Hibernate/Spring with > > respect to the session factory or something that I need to revisit? > > It really seems as though I may have a missing component or a poor > > configuration somewhere. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscribe@... > > For additional commands, e-mail: user-help@... > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ Windows 7: I wanted simpler, now it's simpler. I'm a rock star. http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 |
|
|
Re: Hibernate/SpringChris - I just happened to be learning Hibernate and have created an example application that uses Struts 2, Spring, and Hibernate together.
You can download the example application here: http://www.brucephillips.name/struts/Struts2_Spring_Hibernate_Example.zip After you unzip the archive, you'll find a README.txt in the project's root folder that will explain how to run the project. The application was created using Eclipse 3.5 with the Maven 2 plugin. The JDK used was JVM 1.6 on the Mac. You can import this project into Eclipse by using Eclipse's File - Import feature. You can also run the application using Maven. Navigate in a terminal (command) window to the project's root folder (the folder where pom.xml resides). Issue these commands: mvn clean mvn test (All 7 tests should pass successfully). mvn jetty:run When you see [INFO] Started Jetty Server open a web browser and navigate to http://localhost:8080/index.html. To stop the Jetty web server type CTRL-C in the terminal window. In my example application I have my DAO classes extend Spring's HibernateDaoSupport and I also use Spring's @Transactional annotation in the DAO classes. Both the Spring references below explain this technique (Spring Recipes especially provides helpful examples). References: Hibernate Made Easy, Cameron McKenzie, 2008 Spring Recipes, Gary Mak, 2008 Pro Spring 2.5, Jan Machacek and others, 2008 Bruce Phillips
|
|
|
Re: Hibernate/SpringHi Martin,
I am building a Struts 2 / Spring / Hibernate application, using the JPA specification as it seems to be the case here. It is not required to go through all the pain of using EJB entities. I am running this application both in Websphere and Tomcat, without using the container at all. To me the problem is only a JPA / Hibernate problem, and Spring is totally able to handle that without having to rely on the container. Denis. Martin Gainty a écrit : > good morning denis > > i sent chris a summary of working hibernate examples in Glassfish > the getReference is a method from Ejb3Configuration > the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl (and implements the sessions merge) > whichever app server he will be implementing will have to be configured to serve his specific Bean as an EJBEntity.. > Glassfish Users list would be more helpful > > i hope this clarifies > Martin Gainty > ______________________________________________ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > >> Date: Sat, 14 Nov 2009 08:45:46 -0500 >> From: denis.cabasson@... >> To: user@... >> Subject: Re: Hibernate/Spring >> >> From what you are saying, I would have a look at the : >> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html >> >> My best guess is that this would fix your issue. If not, you probably >> have an issue with the way you are dealing with your entities. >> >> Denis. >> >> >> Chris Cranford a écrit : >> >>> I have done a fair amount of reading today on the topic again and >>> developed a few simple classes to support my service, model, and dao >>> architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The >>> problem I am currently facing is I get a detached error when deleting >>> an object and I get a null pointer exception in SessionImpl.java when >>> I try to locate an object by its id. >>> >>> /* GenericDAO.java */ >>> >>> public T findById(Object id) { >>> return(getEntityManager().find(clazz, id)); >>> } >>> >>> public void delete(T entity) { >>> getEntityManager().remove(entity); >>> } >>> >>> Some posts I have seen say for the delete, you should use >>> getReference() or merge() in order to get an association to the entity >>> before you call the remove() method. I attempted to use the same type >>> of logic with getReference() during the findById() and it failed. >>> >>> Am I missing something in my configuration with Hibernate/Spring with >>> respect to the session factory or something that I need to revisit? >>> It really seems as though I may have a missing component or a poor >>> configuration somewhere. >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@... >>> For additional commands, e-mail: user-help@... >>> >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> > > _________________________________________________________________ > Windows 7: I wanted simpler, now it's simpler. I'm a rock star. > http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Hibernate/Springnever mind him, he is a troll, or a bot, or very very stupid, or all of them.
On Sat, Nov 14, 2009 at 9:18 PM, Denis Cabasson <denis.cabasson@...> wrote: > Hi Martin, > > I am building a Struts 2 / Spring / Hibernate application, using the JPA > specification as it seems to be the case here. It is not required to go > through all the pain of using EJB entities. I am running this application > both in Websphere and Tomcat, without using the container at all. To me the > problem is only a JPA / Hibernate problem, and Spring is totally able to > handle that without having to rely on the container. > > Denis. > > Martin Gainty a écrit : >> >> good morning denis >> >> i sent chris a summary of working hibernate examples in Glassfish >> the getReference is a method from Ejb3Configuration >> the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl >> (and implements the sessions merge) >> whichever app server he will be implementing will have to be configured to >> serve his specific Bean as an EJBEntity.. >> Glassfish Users list would be more helpful >> >> i hope this clarifies Martin Gainty >> ______________________________________________ Verzicht und >> Vertraulichkeitanmerkung/Note de déni et de confidentialité >> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene >> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte >> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht >> dient lediglich dem Austausch von Informationen und entfaltet keine >> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von >> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. >> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le >> destinataire prévu, nous te demandons avec bonté que pour satisfaire >> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie >> de ceci est interdite. Ce message sert à l'information seulement et n'aura >> pas n'importe quel effet légalement obligatoire. Étant donné que les email >> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter >> aucune responsabilité pour le contenu fourni. >> >> >> >> >> >>> >>> Date: Sat, 14 Nov 2009 08:45:46 -0500 >>> From: denis.cabasson@... >>> To: user@... >>> Subject: Re: Hibernate/Spring >>> >>> From what you are saying, I would have a look at the : >>> >>> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html >>> >>> My best guess is that this would fix your issue. If not, you probably >>> have an issue with the way you are dealing with your entities. >>> >>> Denis. >>> >>> >>> Chris Cranford a écrit : >>> >>>> >>>> I have done a fair amount of reading today on the topic again and >>>> developed a few simple classes to support my service, model, and dao >>>> architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The >>>> problem I am currently facing is I get a detached error when deleting >>>> an object and I get a null pointer exception in SessionImpl.java when >>>> I try to locate an object by its id. >>>> >>>> /* GenericDAO.java */ >>>> >>>> public T findById(Object id) { >>>> return(getEntityManager().find(clazz, id)); >>>> } >>>> >>>> public void delete(T entity) { >>>> getEntityManager().remove(entity); >>>> } >>>> >>>> Some posts I have seen say for the delete, you should use >>>> getReference() or merge() in order to get an association to the entity >>>> before you call the remove() method. I attempted to use the same type >>>> of logic with getReference() during the findById() and it failed. >>>> >>>> Am I missing something in my configuration with Hibernate/Spring with >>>> respect to the session factory or something that I need to revisit? >>>> It really seems as though I may have a missing component or a poor >>>> configuration somewhere. >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@... >>>> For additional commands, e-mail: user-help@... >>>> >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@... >>> For additional commands, e-mail: user-help@... >>> >>> >> >> >> _________________________________________________________________ >> Windows 7: I wanted simpler, now it's simpler. I'm a rock star. >> >> http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Hibernate/SpringI wrote up a blog article on using Struts 2, Spring, and Hibernate together.
The article includes an example application and a list of references you can use to learn more about these three technologies. See: http://www.brucephillips.name/blog/index.cfm/2009/11/14/A-Struts-2-Spring-and-Hibernate-Example-Application |
|
|
RE: Hibernate/Springcan we use hibernate to automate mapping of blogCFC entities (specifically blog-category) to Database tables? thanks, Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Sun, 15 Nov 2009 04:18:13 -0800 > From: bphillips@... > To: user@... > Subject: Re: Hibernate/Spring > > > I wrote up a blog article on using Struts 2, Spring, and Hibernate together. > The article includes an example application and a list of references you can > use to learn more about these three technologies. > See: > http://www.brucephillips.name/blog/index.cfm/2009/11/14/A-Struts-2-Spring-and-Hibernate-Example-Application > > -- > View this message in context: http://old.nabble.com/Hibernate-Spring-tp26346725p26358620.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ Hotmail: Trusted email with Microsoft's powerful SPAM protection. http://clk.atdmt.com/GBL/go/177141664/direct/01/ http://clk.atdmt.com/GBL/go/177141664/direct/01/ |
|
|
Re: Hibernate/SpringCan we just remove this "magainty"/"Martin Gainty" from Struts mailing lists? I do not understand what it/he writes.
|
|
|
Re: Hibernate/SpringI tried to. I will try again.
musachy On Sun, Nov 15, 2009 at 10:08 AM, Alex Siman <aleksandr.siman@...> wrote: > > Can we just remove this "magainty"/"Martin Gainty" from Struts mailing lists? > I do not understand what it/he writes. > > Musachy Barroso wrote: >> >> never mind him, he is a troll, or a bot, or very very stupid, or all of >> them. >> >> On Sat, Nov 14, 2009 at 9:18 PM, Denis Cabasson >> <denis.cabasson@...> wrote: >>> Hi Martin, >>> >>> I am building a Struts 2 / Spring / Hibernate application, using the JPA >>> specification as it seems to be the case here. It is not required to go >>> through all the pain of using EJB entities. I am running this application >>> both in Websphere and Tomcat, without using the container at all. To me >>> the >>> problem is only a JPA / Hibernate problem, and Spring is totally able to >>> handle that without having to rely on the container. >>> >>> Denis. >>> >>> Martin Gainty a écrit : >>>> >>>> good morning denis >>>> >>>> i sent chris a summary of working hibernate examples in Glassfish >>>> the getReference is a method from Ejb3Configuration >>>> the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl >>>> (and implements the sessions merge) >>>> whichever app server he will be implementing will have to be configured >>>> to >>>> serve his specific Bean as an EJBEntity.. >>>> Glassfish Users list would be more helpful >>>> >>>> i hope this clarifies Martin Gainty >>>> ______________________________________________ Verzicht und >>>> Vertraulichkeitanmerkung/Note de déni et de confidentialité >>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene >>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede >>>> unbefugte >>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese >>>> Nachricht >>>> dient lediglich dem Austausch von Informationen und entfaltet keine >>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von >>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. >>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas >>>> le >>>> destinataire prévu, nous te demandons avec bonté que pour satisfaire >>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la >>>> copie >>>> de ceci est interdite. Ce message sert à l'information seulement et >>>> n'aura >>>> pas n'importe quel effet légalement obligatoire. Étant donné que les >>>> peuvent facilement être sujets à la manipulation, nous ne pouvons >>>> accepter >>>> aucune responsabilité pour le contenu fourni. >>>> >>>> >>>> >>>> >>>> >>>>> >>>>> Date: Sat, 14 Nov 2009 08:45:46 -0500 >>>>> From: denis.cabasson@... >>>>> To: user@... >>>>> Subject: Re: Hibernate/Spring >>>>> >>>>> From what you are saying, I would have a look at the : >>>>> >>>>> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html >>>>> >>>>> My best guess is that this would fix your issue. If not, you probably >>>>> have an issue with the way you are dealing with your entities. >>>>> >>>>> Denis. >>>>> >>>>> >>>>> Chris Cranford a écrit : >>>>> >>>>>> >>>>>> I have done a fair amount of reading today on the topic again and >>>>>> developed a few simple classes to support my service, model, and dao >>>>>> architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The >>>>>> problem I am currently facing is I get a detached error when deleting >>>>>> an object and I get a null pointer exception in SessionImpl.java when >>>>>> I try to locate an object by its id. >>>>>> >>>>>> /* GenericDAO.java */ >>>>>> >>>>>> public T findById(Object id) { >>>>>> return(getEntityManager().find(clazz, id)); >>>>>> } >>>>>> >>>>>> public void delete(T entity) { >>>>>> getEntityManager().remove(entity); >>>>>> } >>>>>> >>>>>> Some posts I have seen say for the delete, you should use >>>>>> getReference() or merge() in order to get an association to the entity >>>>>> before you call the remove() method. I attempted to use the same type >>>>>> of logic with getReference() during the findById() and it failed. >>>>>> >>>>>> Am I missing something in my configuration with Hibernate/Spring with >>>>>> respect to the session factory or something that I need to revisit? >>>>>> It really seems as though I may have a missing component or a poor >>>>>> configuration somewhere. >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>>> For additional commands, e-mail: user-help@... >>>>>> >>>>>> >>>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>> For additional commands, e-mail: user-help@... >>>>> >>>>> >>>> >>>> >>>> _________________________________________________________________ >>>> Windows 7: I wanted simpler, now it's simpler. I'm a rock star. >>>> >>>> http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@... >>> For additional commands, e-mail: user-help@... >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> >> > > -- > View this message in context: http://old.nabble.com/Hibernate-Spring-tp26346725p26361575.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Hibernate/SpringI tried for a last time, but no, he is here to stay.
On Sun, Nov 15, 2009 at 11:15 AM, Musachy Barroso <musachy@...> wrote: > I tried to. I will try again. > > musachy > > On Sun, Nov 15, 2009 at 10:08 AM, Alex Siman <aleksandr.siman@...> wrote: >> >> Can we just remove this "magainty"/"Martin Gainty" from Struts mailing lists? >> I do not understand what it/he writes. >> >> Musachy Barroso wrote: >>> >>> never mind him, he is a troll, or a bot, or very very stupid, or all of >>> them. >>> >>> On Sat, Nov 14, 2009 at 9:18 PM, Denis Cabasson >>> <denis.cabasson@...> wrote: >>>> Hi Martin, >>>> >>>> I am building a Struts 2 / Spring / Hibernate application, using the JPA >>>> specification as it seems to be the case here. It is not required to go >>>> through all the pain of using EJB entities. I am running this application >>>> both in Websphere and Tomcat, without using the container at all. To me >>>> the >>>> problem is only a JPA / Hibernate problem, and Spring is totally able to >>>> handle that without having to rely on the container. >>>> >>>> Denis. >>>> >>>> Martin Gainty a écrit : >>>>> >>>>> good morning denis >>>>> >>>>> i sent chris a summary of working hibernate examples in Glassfish >>>>> the getReference is a method from Ejb3Configuration >>>>> the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl >>>>> (and implements the sessions merge) >>>>> whichever app server he will be implementing will have to be configured >>>>> to >>>>> serve his specific Bean as an EJBEntity.. >>>>> Glassfish Users list would be more helpful >>>>> >>>>> i hope this clarifies Martin Gainty >>>>> ______________________________________________ Verzicht und >>>>> Vertraulichkeitanmerkung/Note de déni et de confidentialité >>>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene >>>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede >>>>> unbefugte >>>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese >>>>> Nachricht >>>>> dient lediglich dem Austausch von Informationen und entfaltet keine >>>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von >>>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. >>>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas >>>>> le >>>>> destinataire prévu, nous te demandons avec bonté que pour satisfaire >>>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la >>>>> copie >>>>> de ceci est interdite. Ce message sert à l'information seulement et >>>>> n'aura >>>>> pas n'importe quel effet légalement obligatoire. Étant donné que les >>>>> peuvent facilement être sujets à la manipulation, nous ne pouvons >>>>> accepter >>>>> aucune responsabilité pour le contenu fourni. >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> >>>>>> Date: Sat, 14 Nov 2009 08:45:46 -0500 >>>>>> From: denis.cabasson@... >>>>>> To: user@... >>>>>> Subject: Re: Hibernate/Spring >>>>>> >>>>>> From what you are saying, I would have a look at the : >>>>>> >>>>>> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html >>>>>> >>>>>> My best guess is that this would fix your issue. If not, you probably >>>>>> have an issue with the way you are dealing with your entities. >>>>>> >>>>>> Denis. >>>>>> >>>>>> >>>>>> Chris Cranford a écrit : >>>>>> >>>>>>> >>>>>>> I have done a fair amount of reading today on the topic again and >>>>>>> developed a few simple classes to support my service, model, and dao >>>>>>> architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The >>>>>>> problem I am currently facing is I get a detached error when deleting >>>>>>> an object and I get a null pointer exception in SessionImpl.java when >>>>>>> I try to locate an object by its id. >>>>>>> >>>>>>> /* GenericDAO.java */ >>>>>>> >>>>>>> public T findById(Object id) { >>>>>>> return(getEntityManager().find(clazz, id)); >>>>>>> } >>>>>>> >>>>>>> public void delete(T entity) { >>>>>>> getEntityManager().remove(entity); >>>>>>> } >>>>>>> >>>>>>> Some posts I have seen say for the delete, you should use >>>>>>> getReference() or merge() in order to get an association to the entity >>>>>>> before you call the remove() method. I attempted to use the same type >>>>>>> of logic with getReference() during the findById() and it failed. >>>>>>> >>>>>>> Am I missing something in my configuration with Hibernate/Spring with >>>>>>> respect to the session factory or something that I need to revisit? >>>>>>> It really seems as though I may have a missing component or a poor >>>>>>> configuration somewhere. >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>>>> For additional commands, e-mail: user-help@... >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>>> For additional commands, e-mail: user-help@... >>>>>> >>>>>> >>>>> >>>>> >>>>> _________________________________________________________________ >>>>> Windows 7: I wanted simpler, now it's simpler. I'm a rock star. >>>>> >>>>> http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 >>>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@... >>>> For additional commands, e-mail: user-help@... >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@... >>> For additional commands, e-mail: user-help@... >>> >>> >>> >> >> -- >> View this message in context: http://old.nabble.com/Hibernate-Spring-tp26346725p26361575.html >> Sent from the Struts - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@... >> For additional commands, e-mail: user-help@... >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Hibernate/SpringOh well... always good to have some comic relief.
On Tue, Nov 17, 2009 at 10:20 AM, Musachy Barroso <musachy@...> wrote: > I tried for a last time, but no, he is here to stay. > > On Sun, Nov 15, 2009 at 11:15 AM, Musachy Barroso <musachy@...> wrote: >> I tried to. I will try again. >> >> musachy >> >> On Sun, Nov 15, 2009 at 10:08 AM, Alex Siman <aleksandr.siman@...> wrote: >>> >>> Can we just remove this "magainty"/"Martin Gainty" from Struts mailing lists? >>> I do not understand what it/he writes. >>> >>> Musachy Barroso wrote: >>>> >>>> never mind him, he is a troll, or a bot, or very very stupid, or all of >>>> them. >>>> >>>> On Sat, Nov 14, 2009 at 9:18 PM, Denis Cabasson >>>> <denis.cabasson@...> wrote: >>>>> Hi Martin, >>>>> >>>>> I am building a Struts 2 / Spring / Hibernate application, using the JPA >>>>> specification as it seems to be the case here. It is not required to go >>>>> through all the pain of using EJB entities. I am running this application >>>>> both in Websphere and Tomcat, without using the container at all. To me >>>>> the >>>>> problem is only a JPA / Hibernate problem, and Spring is totally able to >>>>> handle that without having to rely on the container. >>>>> >>>>> Denis. >>>>> >>>>> Martin Gainty a écrit : >>>>>> >>>>>> good morning denis >>>>>> >>>>>> i sent chris a summary of working hibernate examples in Glassfish >>>>>> the getReference is a method from Ejb3Configuration >>>>>> the merge method comes from org.hibernate.ejb.AbstractEntityManagerImpl >>>>>> (and implements the sessions merge) >>>>>> whichever app server he will be implementing will have to be configured >>>>>> to >>>>>> serve his specific Bean as an EJBEntity.. >>>>>> Glassfish Users list would be more helpful >>>>>> >>>>>> i hope this clarifies Martin Gainty >>>>>> ______________________________________________ Verzicht und >>>>>> Vertraulichkeitanmerkung/Note de déni et de confidentialité >>>>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene >>>>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede >>>>>> unbefugte >>>>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese >>>>>> Nachricht >>>>>> dient lediglich dem Austausch von Informationen und entfaltet keine >>>>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von >>>>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. >>>>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas >>>>>> le >>>>>> destinataire prévu, nous te demandons avec bonté que pour satisfaire >>>>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la >>>>>> copie >>>>>> de ceci est interdite. Ce message sert à l'information seulement et >>>>>> n'aura >>>>>> pas n'importe quel effet légalement obligatoire. Étant donné que les >>>>>> peuvent facilement être sujets à la manipulation, nous ne pouvons >>>>>> accepter >>>>>> aucune responsabilité pour le contenu fourni. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> >>>>>>> Date: Sat, 14 Nov 2009 08:45:46 -0500 >>>>>>> From: denis.cabasson@... >>>>>>> To: user@... >>>>>>> Subject: Re: Hibernate/Spring >>>>>>> >>>>>>> From what you are saying, I would have a look at the : >>>>>>> >>>>>>> http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html >>>>>>> >>>>>>> My best guess is that this would fix your issue. If not, you probably >>>>>>> have an issue with the way you are dealing with your entities. >>>>>>> >>>>>>> Denis. >>>>>>> >>>>>>> >>>>>>> Chris Cranford a écrit : >>>>>>> >>>>>>>> >>>>>>>> I have done a fair amount of reading today on the topic again and >>>>>>>> developed a few simple classes to support my service, model, and dao >>>>>>>> architecture for using Hibernate 3.3.2 and Spring 2 with Struts2. The >>>>>>>> problem I am currently facing is I get a detached error when deleting >>>>>>>> an object and I get a null pointer exception in SessionImpl.java when >>>>>>>> I try to locate an object by its id. >>>>>>>> >>>>>>>> /* GenericDAO.java */ >>>>>>>> >>>>>>>> public T findById(Object id) { >>>>>>>> return(getEntityManager().find(clazz, id)); >>>>>>>> } >>>>>>>> >>>>>>>> public void delete(T entity) { >>>>>>>> getEntityManager().remove(entity); >>>>>>>> } >>>>>>>> >>>>>>>> Some posts I have seen say for the delete, you should use >>>>>>>> getReference() or merge() in order to get an association to the entity >>>>>>>> before you call the remove() method. I attempted to use the same type >>>>>>>> of logic with getReference() during the findById() and it failed. >>>>>>>> >>>>>>>> Am I missing something in my configuration with Hibernate/Spring with >>>>>>>> respect to the session factory or something that I need to revisit? >>>>>>>> It really seems as though I may have a missing component or a poor >>>>>>>> configuration somewhere. >>>>>>>> >>>>>>>> --------------------------------------------------------------------- >>>>>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>>>>> For additional commands, e-mail: user-help@... >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> --------------------------------------------------------------------- >>>>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>>>> For additional commands, e-mail: user-help@... >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> _________________________________________________________________ >>>>>> Windows 7: I wanted simpler, now it's simpler. I'm a rock star. >>>>>> >>>>>> http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009 >>>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: user-unsubscribe@... >>>>> For additional commands, e-mail: user-help@... >>>>> >>>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@... >>>> For additional commands, e-mail: user-help@... >>>> >>>> >>>> >>> >>> -- >>> View this message in context: http://old.nabble.com/Hibernate-Spring-tp26346725p26361575.html >>> Sent from the Struts - User mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@... >>> For additional commands, e-mail: user-help@... >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |