[EJB 3.0] - Strange mapping problem...
by taprogge
Hello all!
I have here a strange mapping problem on my hands (at least it seems strange to me). Perhaps anyone here can enlighten me.
I have an entity model that contains (among other things) two entities (Cheque and BonusCard) that work perfectly by themselves.
Cheque is an obstract class with InheritenceStrategy.JOINED, BonusCard is the only class in it's hirarchy.
I now would like them to extend a common superclass, again JOINED.
When I do this, suddenly hibernate complains like this on a field on the BonusCard:
| org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Column(accountList)]
|
Since I have no idea where my mistake might lie, I will post the classes here.
Any hints are very much appreciated.
This is the intended superclass:
| @Entity
| @Table(name = "VOUCHER")
| @Inheritance(strategy = InheritanceType.JOINED)
| public abstract class Voucher implements Serializable {
|
| @Id
| @Column(name = "ID")
| private long id;
|
| @Column(name = "BARCODE")
| @NotNull
| private String barcode;
|
| @Version
| @Column(name = "CNT_VERSION")
| private long versionCounter;
|
| @NotNull
| @ManyToOne
| @JoinColumn(name = "CHARGE")
| private Charge charge;
|
| [... getters and setters ...]
| }
|
This is the Cheque class:
| @Entity
| @Table(name = "CHEQUE")
| @Inheritance(strategy = InheritanceType.JOINED)
| public abstract class Cheque extends Voucher implements Serializable {
|
| @NotNull
| @ManyToOne(optional = false)
| @JoinColumn(name = "CHEQUE_STATUS")
| private ChequeStatus chequeStatus;
|
| @ManyToOne
| @JoinColumn(name = "CUSTOMER")
| private Customer customer;
|
| @NotNull
| private Date expires;
|
| @ManyToOne
| @JoinColumn(name = "ACQUIRER")
| private Acquirer redeemingAcquirer;
|
| [... getters and setters ...]
| }
|
This is the BonusCard class:
| @Entity
| @Table(name = "BONUSCARD")
| @Inheritance(strategy = InheritanceType.JOINED)
| public class BonusCard extends Voucher implements Serializable {
|
| @ManyToMany
| private List<CustomerUser> distributeUsers;
|
| @ManyToOne(optional = false)
| private CustomerUser managingUser;
|
| @ManyToOne
| private User user;
|
| @ManyToOne(optional = false)
| private BonusCardStatus bonusCardStatus;
|
| @OneToMany(mappedBy = "bonusCard", cascade = (CascadeType.ALL))
| private List<CardAccount> accountList;
|
| @NotNull
| @Column(name = "EXPIRES")
| private Date expires;
|
| [... getters and setters ...]
| }
|
And finally the Charge I want them both to be associated with:
| @Entity
| @Table(name = "CHARGE")
| public class Charge implements Serializable {
|
| @Id
| @NotNull
| @Column(name = "ID_CHARGE")
| private int chargeId;
|
| @OneToMany(mappedBy = "charge")
| private List<Voucher> vouchers;
|
| @ManyToOne
| private Customer customer;
|
| @ManyToOne(optional = false)
| private ChargeStatus status;
|
| @ManyToOne
| @JoinColumn(name = "ACQUIRERGROUP")
| private AcquirerGroup acquirerGroup;
|
| [... getters and setters ...]
| }
|
Thanks in advance for any advice you might have.
Regards,
Phil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964941#3964941
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964941
19 years, 10 months
[JBoss Messaging] - Re: SQLException: Invalid column index in CR4
by mwelss
we encounter the same problem with CR4:
anonymous wrote :
| 2006-08-14 13:17:10,204 DEBUG [org.jboss.jms.server.destination.Queue] Starting jboss.messaging.destination:service=Queue,name=acd-call-signal
| s
| 2006-08-14 13:17:10,206 DEBUG [org.jboss.messaging.core.plugin.JDBCPersistenceManager] Updating all reliable references to not loaded
| 2006-08-14 13:17:10,214 ERROR [org.jboss.jms.server.plugin.JDBCChannelMapper] Failed to load queue state
| java.sql.SQLException: Column Index out of range, 4 > 3.
| at com.mysql.jdbc.ResultSet.checkColumnBounds(ResultSet.java:657)
| at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:3678)
| at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:4906)
| at com.mysql.jdbc.ResultSet.getString(ResultSet.java:4739)
| at org.jboss.resource.adapter.jdbc.WrappedResultSet.getString(WrappedResultSet.java:865)
| at org.jboss.messaging.core.plugin.JDBCPersistenceManager.getReferenceInfos(JDBCPersistenceManager.java:1431)
| at org.jboss.messaging.core.ChannelSupport.load(ChannelSupport.java:1273)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964940#3964940
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964940
19 years, 10 months
[Persistence, JBoss/CMP, Hibernate, Database] - Read-ahead, left-join, oracle problem
by ingo77
Hi super-boosters
I need to use read-ahead for a CMR.
So I configured my jbosscmp-jdbc.xml:
<read-ahead>
on-find
<page-size>4</page-size>
<eager-load-group>basic</eager-load-group>
<left-join cmr-field="students" eager-load-group="basic"/>
</read-ahead>
So far so good, the created sql is "correct"
select column1,column2...... from a left outer join b.........
The problem is that Oracle not supports this kind of join. I need something like:
select column1,column2...... from a, b where .......
Seems to me as a common problem but I can't find a solution.
Thanks in advance for all comments, I'm kind of stuck here.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964935#3964935
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964935
19 years, 10 months
[Security & JAAS/JBoss] - Re: Webapp Auth/Auth with Custom LoginModule Principals
by ppareit
I have the same problem:
I use the following realm code:
| if (!subject.getPrincipals().contains(userPrincipal))
| subject.getPrincipals().add(userPrincipal);
| subject.getPrincipals().addAll(rolePrincipals);
|
Where userPrinipal an instance of UserPrincipal (Framework class), and RolePrincipals is ArrayList (Framework class).
In my application I use the following code:
| locale = (Locale) principal.getClass().getMethod("getLocale",(Class[]) null).invoke(principal, (Object[]) null);
|
| dateFormat = (String) principal.getClass().getMethod("getDateFormat", (Class[]) null).invoke(principal,(Object[]) null);
|
On a Tomcat 5.5 server everything works fine.
On Jboss 4.0.4 GA: I get the following exception:
| java.lang.NoSuchMethodException: org.jboss.security.SimplePrincipal.getLocale()
| at java.lang.Class.getMethod(Class.java:1581)
| at com.easypaygroup.framework.control.userprofile.UserProfile.<init>(UserProfile.java:70)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
| at java.lang.Class.newInstance0(Class.java:350)
| at java.lang.Class.newInstance(Class.java:303)
| at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:274)
| at org.apache.myfaces.shared_impl.util.ClassUtils.newInstance(ClassUtils.java:265)
| at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:50)
| at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:311)
| at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
| at org.apache.myfaces.el.ValueBindingImpl$ELVariableResolver.resolveVariable(ValueBindingImpl.java:574)
| at org.apache.commons.el.NamedValue.evaluate(NamedValue.java:124)
| at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:140)
| at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
| at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:199)
| at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:536)
| at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:312)
| at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)
| at org.apache.jsp.com.easypaygroup.easytest.webapp.menu.menu_jsp._jspService(menu_jsp.java:64)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
|
| ............
|
| java.lang.IllegalArgumentException: Locale or String class expected. Expression: #{UserProfile.locale}. Return value nul
| l
| at org.apache.myfaces.taglib.core.ViewTag.setProperties(ViewTag.java:218)
| at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:536)
| at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:312)
| at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:70)
| at org.apache.jsp.com.easypaygroup.easytest.webapp.menu.menu_jsp._jspService(menu_jsp.java:64)
| at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
| at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:367)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at com.easypaygroup.framework.hibernate.CloseSessionFilter.doFilter(CloseSessionFilter.java:28)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
| :664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964934#3964934
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964934
19 years, 10 months