axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ANTHONY ENNIS <tony.en...@insightbb.com>
Subject Re: RE: hibernate and axis2
Date Wed, 30 Sep 2009 17:50:17 GMT
I solved this one by making all pojo attributes being generated by hbm2java as long and boolean
to instead be Long and Boolean.  I did this by modifying the reveng.xml file using the <column...>
entity.


----- Original Message -----
From: Martin Gainty <mgainty@hotmail.com>
Date: Wednesday, September 30, 2009 13:14
Subject: RE: hibernate and axis2
To: tony.ennis@insightbb.com

> 
> java.lang.Long is a java class here is an example (apparently 
> this scooter can exceed warp1)
> 
> import javax.persistence.Entity;
> import javax.persistence.Id;
> /*** @author Emmanuel Bernard */
> @Entity
> public class Scooter {
>     private String model;
>     private Long speed;
> 
>     @Id
>     public String getModel() {
>         return model;
>     }
>     public void setModel(String model) {
>         this.model = model;
>     }
> 
>     public Long getSpeed() { return speed;}
>     public void setSpeed(Long speed) {  
> this.speed = speed; }
> }
> 
> //long is a java primitive datatype .. usage is illustrated here
> 
> //$Id: Cat.java 14964 2008-07-23 10:24:01Z hardy.ferentschik $
> package org.hibernate.ejb.test;
> import java.io.Serializable;
> import java.util.ArrayList;
> import java.util.Calendar;
> import java.util.Collections;
> import java.util.Date;
> import java.util.GregorianCalendar;
> import java.util.List;
> 
> import javax.persistence.Basic;
> import javax.persistence.CascadeType;
> import javax.persistence.Entity;
> import javax.persistence.EntityListeners;
> import javax.persistence.GeneratedValue;
> import javax.persistence.Id;
> import javax.persistence.OneToMany;
> import javax.persistence.PostLoad;
> import javax.persistence.PostPersist;
> import javax.persistence.PostUpdate;
> import javax.persistence.Temporal;
> import javax.persistence.TemporalType;
> import javax.persistence.Transient;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> 
> /*** @author Emmanuel Bernard*/
> @SuppressWarnings({"unchecked", "serial"})
> @Entity
> @EntityListeners( LastUpdateListener.class )
> public class Cat implements Serializable {
> <snip>        
>     private Integer id;
>     private long length;
> 
>     @Id
>     @GeneratedValue
>     public Integer getId() { return id; }
>     public void setId(Integer id) { this.id = id; }
> 
>     public long getLength() { return length; }
>     public void setLength(long length) { 
> this.length = length; }
> <snip>    
> }
> 
> a possible miscommunication is if the database you are 
> persisting to doesnt support long datatype
> to locate DB take a look at persistence.xml or hibernate.cfg.xml 
> to check hibernate.dialect
>             <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
> can you confirm ?
> 
> 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: Wed, 30 Sep 2009 12:41:49 -0400
> From: tony.ennis@insightbb.com
> Subject: Re: hibernate and axis2
> To: axis-user@ws.apache.org
> 
> I started this morning with the Andreas' solution as it is 
> easiest to implement.  I got farther.  The web service 
> finds the persistence file and starts mapping the classes.
> Now I am getting the following exception, which amuses me somehow:
> 
> "java.lang.ClassNotFoundException: Class Not found : long"
> 
> I thought 'long' was baked into Java.  If I manually change 
> the generated model pojos to use Long instead of long, it seems 
> to work a little better (until 
> Persistence.createEntityManagerFactory advances to a pojo I 
> haven't hand-edited...)  Obviously I don't want to hand 
> edit these files, but doing so yielded good information.  I 
> seem to be missing a critical jar from my classpath if "long" 
> isn't recognized.  That it uses "long" is a bit of a 
> mystery as other similar columns are Long. The DDL is the same 
> except the Long columns are primary keys.  So I need to 
> encourage hbm2java to generate Long instead of long, or tell 
> hibernate that "long" types are built-in. Oddly, 
> Persistence.createEntityManagerFactory  works if I run 
> locally (ie not as a web service.)
> 
> Regarding Robert's comment, I have no "need" for a session to 
> isolated to axis2, but that's going to be the effect.  The 
> user will lob a text file at my web service, and my web service 
> will make some response.  That's the entire activity.  
> Usage volume will be medium-low.  I may add more end-
> points, but I don't know that I'll be adding any more aar files.
> 
> ----- Original Message -----
> From: robert lazarski <robertlazarski@gmail.com>
> Date: Wednesday, September 30, 2009 9:55
> Subject: Re: hibernate and axis2
> To: axis-user@ws.apache.org
> 
> > On Wed, Sep 30, 2009 at 9:53 AM, Andreas Veithen
> > <andreas.veithen@gmail.com> wrote:
> > >> I suggest you don't put all these jar's in the aar, put 
> them in
> > >> WEB-INF/lib . hibernate uses the TCCL and that won't work 
> > directly in
> > >> an aar without some extra effort.
> > >
> > > It should be enough to add the following parameter to the service:
> > >
> > > <parameter name="ServiceTCCL" 
> > locked="false">composite</parameter>>
> > >
> > > Andreas
> > >
> > 
> > Right. With only one end user aar and without the OP showing a 
> > need to
> > have a hibernate session isolated to axis2, however, its probably
> > overkill. Its possible to do spring and/or hibernate per aar, 
> I just
> > think it rarely makes sense. Just my 2 brazilian centavos :-) .
> > 
> > - R
> >                                              

> _________________________________________________________________
> Lauren found her dream laptop. Find the PC that’s right for you.
> http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290

Mime
View raw message