-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: Problem using String for Id
PostPosted: Tue Oct 21, 2008 12:18 am 
Newbie

Joined: Thu Dec 28, 2006 11:14 pm
Posts: 5
Location: Salt Lake City, UT
I am trying to implement JPA/Hibernate with an existing PostgreSQL database where the Id columns are of type String. I am getting an error that seems to indicate that the error is in trying to cast the sequence value from an integer value to a String to populate the id property (pid). Here is the entity bean and the stacktrace. I'm using Hibernate 3.2.1.GA

The entity:
Code:
package com.wjbradley.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.validator.NotNull;

@Entity
@Table(name = "facility", uniqueConstraints = @UniqueConstraint(columnNames = "facilityid"))
@SequenceGenerator(name = "facility_sequence", sequenceName = "facility_seq")
public class Facility implements java.io.Serializable {

   private String pid;
   private String facilityid;
   private String name;
   private String addrstreet;
   private String addrunit;
   private String addrcity;
   private String addrstate;
   private String addrcountry;
   private String addrpost;
   private String addrauxpost;
   private Boolean applcap;
   private Boolean proccap;
   private Boolean uwcap;
   private Boolean closcap;
   private Boolean fundcap;
   private Boolean shipcap;
   private String asicenter;
   private String phone;
   private String fax;
   private String fhalenderid;
   private String valenderid;
   private int pidVersion;
   private String lenderPid;
   private Set<Party> parties = new HashSet<Party>(0);

   public Facility() {
   }

   public Facility(String pid, int pidVersion) {
      this.pid = pid;
      this.pidVersion = pidVersion;
   }
   public Facility(String pid, String facilityid, String name,
         String addrstreet, String addrunit, String addrcity,
         String addrstate, String addrcountry, String addrpost,
         String addrauxpost, Boolean applcap, Boolean proccap,
         Boolean uwcap, Boolean closcap, Boolean fundcap, Boolean shipcap,
         String asicenter, String phone, String fax, String fhalenderid,
         String valenderid, int pidVersion, String lenderPid,
         Set<Party> parties) {
      this.pid = pid;
      this.facilityid = facilityid;
      this.name = name;
      this.addrstreet = addrstreet;
      this.addrunit = addrunit;
      this.addrcity = addrcity;
      this.addrstate = addrstate;
      this.addrcountry = addrcountry;
      this.addrpost = addrpost;
      this.addrauxpost = addrauxpost;
      this.applcap = applcap;
      this.proccap = proccap;
      this.uwcap = uwcap;
      this.closcap = closcap;
      this.fundcap = fundcap;
      this.shipcap = shipcap;
      this.asicenter = asicenter;
      this.phone = phone;
      this.fax = fax;
      this.fhalenderid = fhalenderid;
      this.valenderid = valenderid;
      this.pidVersion = pidVersion;
      this.lenderPid = lenderPid;
      this.parties = parties;
   }

   @Id
   @Column(name = "pid", unique = true, nullable = false)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "facility_sequence")
    @NotNull
   public String getPid() {
      return this.pid;
   }

   public void setPid(String pid) {
      this.pid = pid;
   }

   @Column(name = "facilityid", unique = true)
   public String getFacilityid() {
      return this.facilityid;
   }

   public void setFacilityid(String facilityid) {
      this.facilityid = facilityid;
   }

   @Column(name = "name")
   public String getName() {
      return this.name;
   }

   public void setName(String name) {
      this.name = name;
   }

   @Column(name = "addrstreet")
   public String getAddrstreet() {
      return this.addrstreet;
   }

   public void setAddrstreet(String addrstreet) {
      this.addrstreet = addrstreet;
   }

   @Column(name = "addrunit")
   public String getAddrunit() {
      return this.addrunit;
   }

   public void setAddrunit(String addrunit) {
      this.addrunit = addrunit;
   }

   @Column(name = "addrcity")
   public String getAddrcity() {
      return this.addrcity;
   }

   public void setAddrcity(String addrcity) {
      this.addrcity = addrcity;
   }

   @Column(name = "addrstate")
   public String getAddrstate() {
      return this.addrstate;
   }

   public void setAddrstate(String addrstate) {
      this.addrstate = addrstate;
   }

   @Column(name = "addrcountry")
   public String getAddrcountry() {
      return this.addrcountry;
   }

   public void setAddrcountry(String addrcountry) {
      this.addrcountry = addrcountry;
   }

   @Column(name = "addrpost")
   public String getAddrpost() {
      return this.addrpost;
   }

   public void setAddrpost(String addrpost) {
      this.addrpost = addrpost;
   }

   @Column(name = "addrauxpost")
   public String getAddrauxpost() {
      return this.addrauxpost;
   }

   public void setAddrauxpost(String addrauxpost) {
      this.addrauxpost = addrauxpost;
   }

   @Column(name = "applcap")
   public Boolean getApplcap() {
      return this.applcap;
   }

   public void setApplcap(Boolean applcap) {
      this.applcap = applcap;
   }

   @Column(name = "proccap")
   public Boolean getProccap() {
      return this.proccap;
   }

   public void setProccap(Boolean proccap) {
      this.proccap = proccap;
   }

   @Column(name = "uwcap")
   public Boolean getUwcap() {
      return this.uwcap;
   }

   public void setUwcap(Boolean uwcap) {
      this.uwcap = uwcap;
   }

   @Column(name = "closcap")
   public Boolean getCloscap() {
      return this.closcap;
   }

   public void setCloscap(Boolean closcap) {
      this.closcap = closcap;
   }

   @Column(name = "fundcap")
   public Boolean getFundcap() {
      return this.fundcap;
   }

   public void setFundcap(Boolean fundcap) {
      this.fundcap = fundcap;
   }

   @Column(name = "shipcap")
   public Boolean getShipcap() {
      return this.shipcap;
   }

   public void setShipcap(Boolean shipcap) {
      this.shipcap = shipcap;
   }

   @Column(name = "asicenter")
   public String getAsicenter() {
      return this.asicenter;
   }

   public void setAsicenter(String asicenter) {
      this.asicenter = asicenter;
   }

   @Column(name = "phone")
   public String getPhone() {
      return this.phone;
   }

   public void setPhone(String phone) {
      this.phone = phone;
   }

   @Column(name = "fax")
   public String getFax() {
      return this.fax;
   }

   public void setFax(String fax) {
      this.fax = fax;
   }

   @Column(name = "fhalenderid")
   public String getFhalenderid() {
      return this.fhalenderid;
   }

   public void setFhalenderid(String fhalenderid) {
      this.fhalenderid = fhalenderid;
   }

   @Column(name = "valenderid")
   public String getValenderid() {
      return this.valenderid;
   }

   public void setValenderid(String valenderid) {
      this.valenderid = valenderid;
   }

   @Column(name = "pid_version", nullable = false)
   @NotNull
   public int getPidVersion() {
      return this.pidVersion;
   }

   public void setPidVersion(int pidVersion) {
      this.pidVersion = pidVersion;
   }

   @Column(name = "lender_pid")
   public String getLenderPid() {
      return this.lenderPid;
   }

   public void setLenderPid(String lenderPid) {
      this.lenderPid = lenderPid;
   }
   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "facility")
   public Set<Party> getParties() {
      return this.parties;
   }

   public void setParties(Set<Party> parties) {
      this.parties = parties;
   }

}



The stacktrace:
Code:
2008-10-20 16:14:38,676 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/WJBPrototype].[Persistent Faces Servlet]] Servlet.service() for servlet Persistent Faces Servlet threw exception
javax.faces.FacesException: #{facilityHome.persist}: java.lang.ClassCastException: java.lang.String
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
   at javax.faces.component.UICommand.broadcast(UICommand.java:387)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:755)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
   at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:54)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:42)
   at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)
   at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
   at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
   at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
   at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:79)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:343)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
   at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:54)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Thread.java:613)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: java.lang.String
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
   ... 61 more
Caused by: java.lang.ClassCastException: java.lang.String
   at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
   at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
   at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
   at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
   at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
   at com.wjbradley.session.FacilityHome_$$_javassist_6.persist(FacilityHome_$$_javassist_6.java)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
   ... 62 more
2008-10-20 16:14:38,677 WARN  [org.jboss.seam.web.ExceptionFilter] handling uncaught exception
javax.faces.FacesException: #{facilityHome.persist}: java.lang.ClassCastException: java.lang.String
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
   at javax.faces.component.UICommand.broadcast(UICommand.java:387)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:755)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
   at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:54)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:42)
   at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)
   at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
   at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
   at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
   at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:79)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:343)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
   at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:54)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)

   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Thread.java:613)
Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: java.lang.String
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
   ... 61 more
Caused by: java.lang.ClassCastException: java.lang.String
   at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
   at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
   at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
   at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
   at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
   at com.wjbradley.session.FacilityHome_$$_javassist_6.persist(FacilityHome_$$_javassist_6.java)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
   ... 62 more
2008-10-20 16:14:38,683 WARN  [org.jboss.seam.web.ExceptionFilter] exception root cause
javax.faces.el.EvaluationException: java.lang.ClassCastException: java.lang.String
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
   at javax.faces.component.UICommand.broadcast(UICommand.java:387)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:755)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
   at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:54)
   at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:42)
   at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)
   at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
   at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
   at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
   at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
   at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
   at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
   at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:79)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:343)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
   at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:54)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
   at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ClassCastException: java.lang.String
   at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
   at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
   at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
   at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
   at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
   at com.wjbradley.session.FacilityHome_$$_javassist_6.persist(FacilityHome_$$_javassist_6.java)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
   ... 62 more


[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 21, 2008 2:10 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
The sequence generator can only generate numeric values. You need to use an id generator that generates string values. Among the Hibernate built-in generators it is only the 'uuid', 'guid' and 'assigned' generators that seems to be able to do this (see http://www.hibernate.org/hib_docs/v3/re ... -generator). It might be possible to create your own sequence-like (subclass of the SequenceHiLoGenerator class?) generator that converts the generated numbers to a string.


Top
 Profile  
 
 Post subject: Thinking of using Assigned
PostPosted: Wed Oct 22, 2008 3:17 pm 
Newbie

Joined: Thu Dec 28, 2006 11:14 pm
Posts: 5
Location: Salt Lake City, UT
To solve this, one of the options I'm looking at is using Assigned, and just creating a util class that gets the sequence and sets it on the object prior to insert. This seems clean enough on the surface, but I would be interested in anybody's opinion on using this technique. One obvious disadvantage is that it is not portable between databases, but we are not looking to change products.

Other thoughts?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 22, 2008 4:00 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Check the code for the org.hibernate.id.SequenceHiLoGenerator. It is not big and I think it should be easy enough to create a new class that is subclassing SequenceGenerator so it returns a String instead of a number. In fact, you can probably just copy and paste the major part of the code from SequenceHiLoGenerator and replace the calls to IdentifierGeneratorFactory.createNumber() with something generates converts the number to a String.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2008 12:16 pm 
Newbie

Joined: Thu Dec 28, 2006 11:14 pm
Posts: 5
Location: Salt Lake City, UT
Ok, I extended SequenceHiLoGenerator so that I can return a String, but I'm not finding where I tell Hibernate to use my class to do the sequence generation. I'm assuming somewhere there is a mapping from the annotation GenerationStrategy.SEQUENCE to the actual class that is called to generate the Id, but I can't find it in the docs or even a text search through my entire project.


Top
 Profile  
 
 Post subject: Figured it out, but still getting error
PostPosted: Thu Oct 23, 2008 12:40 pm 
Newbie

Joined: Thu Dec 28, 2006 11:14 pm
Posts: 5
Location: Salt Lake City, UT
I figured out that I needed to use the GenericGenerator, which I did, but I still get the error in the Hibernate class. I tried to look the code to see what it is doing, but the line number seems to point to the Logger property instead of the generate method. I'm sure I have the right source tied to the right binaries. Anyway, here is the stacktrace:

Code:
Caused by: java.lang.ClassCastException: java.lang.String
   at org.hibernate.id.SequenceHiLoGenerator.generate(SequenceHiLoGenerator.java:58)
   at com.wjbradley.common.db.WJBSequenceGenerator2.generate(WJBSequenceGenerator2.java:14)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
   at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
   at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
   at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
   at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
   at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
   at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:137)
   at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
   at com.wjbradley.session.FacilityHome.persist(FacilityHome.java:22)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
   at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
   at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
   at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
   at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
   at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
   at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
   at com.wjbradley.session.FacilityHome_$$_javassist_6.persist(FacilityHome_$$_javassist_6.java)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
   at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
   at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
   at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
   at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 24, 2008 2:22 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Oh, I maybe I wasn't clear. I think you should subclass the SequenceGenerator, not the SequenceHiLoGenerator. The latter only works with numbers but the code is simple and I figured if you copy this code there are only a few lines that needs to be replaced, for example, IdentifierGeneratorFactory.createNumber()) is replaced with Long.toString().

I am not very familiar with using Hibernate annotations, but from the docs (http://www.hibernate.org/hib_docs/annot ... ml#d0e2167) it seem like you should use something like @GenericGenerator(... strategy="full.class.name.of.your.generator")


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 24, 2008 12:11 pm 
Newbie

Joined: Thu Dec 28, 2006 11:14 pm
Posts: 5
Location: Salt Lake City, UT
Thanks for the clarification. I'll give that a try. And I was able to figure out how to use the @GenericGenerator to call my class directly. I'll let you know what happens.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.