JBoss version:4.0.4
Hibernate version:3.2
Database:Oracle 10g
Hi. I am facing an entity mapping problem. I have an Oracle stored function which takes as a parameter an Oracle array and returns a refcursor. And I want to map the returning result to an entity class. I have created the entity class as follows:
@Entity
@SqlResultSetMa pping(name = "flightBaggageS ummaryMapping",
entities = @EntityResult(e ntityClass = FlightBaggageSu mmary.class))
@NamedNativeQue ry(name = "flightBaggageS ummaryQuery",
query = "{?=call MULTI_FLIGHT_PA X_AND_BAG_COUNT (:flightList)}" ,
resultSetMappin g = "flightBaggageS ummaryMapping",
hints = {@QueryHint(nam e = "org.hibernate. callable", value = "true"),
@QueryHint(name = "org.hibernate. readOnly", value = "true")})
public class FlightBaggageSu mmary implements Serializable
{
private static final long serialVersionUI D = 1;
private long flightId;
private long checkedInBags;
private long loadedBaggageHa llBags;
@Id
public long getFlightId()
{
return flightId;
}
public void setFlightId(lon g flightId)
{
this.flightId=f lightId;
}
// Accessors and mutators and @Column annotations here
...
}
And in a Facade, I have the following method:
public List<FlightBagg ageSummary> getFlightBaggag eSummary(Long[] flightIds) throws ApplicationTier Exception
{
// Validate parameter
if (flightIds == null || flightIds.lengt h == 0)
{
throw new IllegalArgument Exception();
}
ARRAY arrayOfFlightId s = null;
try
{
// The datasource is a member variable of the Facade
Connection connection = ((WrappedConnec tion)dataSource .getConnection( )).getUnderlyin gConnection();
// FLIGHT_LIST is the Oracle array type that is passed as aparameter in the stored function
ArrayDescriptor arrayDescriptor = ArrayDescriptor .createDescript or("FLIGHT_LIST ", connection);
arrayOfFlightId s = new ARRAY(arrayDesc riptor, connection, flightIds);
}
catch (SQLException e)
{
throw new ApplicationTier Exception(e);
}
Query query = entityManager.c reateNamedQuery ("flightBaggage SummaryQuery"). setParameter("f lightList", arrayOfFlightId s);
return (List<FlightBag gageSummary>) query.getResult List();
}
to get information about flights & I get following exception:
(Exception in next post)
1 2740
Stack trace:javax.ejb .EJBException: javax.persisten ce.PersistenceE xception: org.hibernate.t ype.Serializati onException: could not serialize
at org.jboss.ejb3. tx.Ejb3TxPolicy .handleExceptio nInOurTx(Ejb3Tx Policy.java:69)
at org.jboss.aspec ts.tx.TxPolicy. invokeInOurTx(T xPolicy.java:83 )
at org.jboss.aspec ts.tx.TxInterce ptor$Required.i nvoke(TxInterce ptor.java:197)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.aspec ts.tx.TxPropaga tionInterceptor .invoke(TxPropa gationIntercept or.java:76)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. stateless.State lessInstanceInt erceptor.invoke (StatelessInsta nceInterceptor. java:62)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.aspec ts.security.Rol eBasedAuthoriza tionInterceptor .invoke(RoleBas edAuthorization Interceptor.jav a:167)
at org.jboss.ejb3. security.RoleBa sedAuthorizatio nInterceptor.in voke(RoleBasedA uthorizationInt erceptor.java:1 00)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.aspec ts.security.Aut henticationInte rceptor.invoke( AuthenticationI nterceptor.java :78)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. ENCPropagationI nterceptor.invo ke(ENCPropagati onInterceptor.j ava:47)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. asynchronous.As ynchronousInter ceptor.invoke(A synchronousInte rceptor.java:10 6)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. stateless.State lessContainer.l ocalInvoke(Stat elessContainer. java:181)
at org.jboss.ejb3. stateless.State lessLocalProxy. invoke(Stateles sLocalProxy.jav a:79)
at $Proxy107.getFl ightBaggageSumm ary(Unknown Source)
at com.app.web.del egates.FlightSe rvicesDelegate. getFlightBaggag eSummary(Flight ServicesDelegat e.java:202)
at com.app.web.ser vlets.flight.Fl ightLoopServlet .doGet(FlightLo opServlet.java: 213)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:697)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:810)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:252)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:173)
at com.app.web.fil ters.EncodingFi lter.doFilter(E ncodingFilter.j ava:110) at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter ApplicationFilt erChain.java:20 2)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:173)
at com.app.web.fil ters.FlightLoop Filter.doFilter (FlightLoopFilt er.java:112) at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:202)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:173)
at com.app.web.fil ters.UserContex tFilter.doFilte r(UserContextFi lter.java:149)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:202)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:173)
at org.jboss.web.t omcat.filters.R eplyHeaderFilte r.doFilter(Repl yHeaderFilter.j ava:96)
at org.apache.cata lina.core.Appli cationFilterCha in.internalDoFi lter(Applicatio nFilterChain.ja va:202)
at org.apache.cata lina.core.Appli cationFilterCha in.doFilter(App licationFilterC hain.java:173)
at org.apache.cata lina.core.Stand ardWrapperValve .invoke(Standar dWrapperValve.j ava:213)
at org.apache.cata lina.core.Stand ardContextValve .invoke(Standar dContextValve.j ava:178)
at org.jboss.web.t omcat.security. SecurityAssocia tionValve.invok e(SecurityAssoc iationValve.jav a:175)
at org.apache.cata lina.authentica tor.Authenticat orBase.invoke(A uthenticatorBas e.java:524)
at org.jboss.web.t omcat.security. JaccContextValv e.invoke(JaccCo ntextValve.java :74)
at org.apache.cata lina.core.Stand ardHostValve.in voke(StandardHo stValve.java:12 6)
at org.apache.cata lina.valves.Err orReportValve.i nvoke(ErrorRepo rtValve.java:10 5)
at org.apache.cata lina.core.Stand ardEngineValve. invoke(Standard EngineValve.jav a:107)
at org.apache.cata lina.connector. CoyoteAdapter.s ervice(CoyoteAd apter.java:148)
at org.apache.coyo te.http11.Http1 1Processor.proc ess(Http11Proce ssor.java:869)
at org.apache.coyo te.http11.Http1 1BaseProtocol$H ttp11Connection Handler.process Connection(Http 11BaseProtocol. java:664)
at org.apache.tomc at.util.net.Poo lTcpEndpoint.pr ocessSocket(Poo lTcpEndpoint.ja va:527)
at org.apache.tomc at.util.net.Mas terSlaveWorkerT hread.run(Maste rSlaveWorkerThr ead.java:112)
at java.lang.Threa d.run(Unknown Source)
Caused by: javax.persisten ce.PersistenceE xception: org.hibernate.t ype.Serializati onException: could not serialize
at org.hibernate.e jb.AbstractEnti tyManagerImpl.t hrowPersistence Exception(Abstr actEntityManage rImpl.java:567)
at org.hibernate.e jb.QueryImpl.ge tResultList(Que ryImpl.java:56)
at com.ultra_as.ul tratrak.applica tion.services.F lightServiceFac adeBean.getFlig htBaggageSummar y(FlightService FacadeBean.java :243)
at sun.reflect.Nat iveMethodAccess orImpl.invoke0( Native Method)
at sun.reflect.Nat iveMethodAccess orImpl.invoke(U nknown Source)
at sun.reflect.Del egatingMethodAc cessorImpl.invo ke(Unknown Source)
at java.lang.refle ct.Method.invok e(Unknown Source)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 12)
at org.jboss.ejb3. interceptor.Inv ocationContextI mpl.proceed(Inv ocationContextI mpl.java:166)
at org.jboss.ejb3. interceptor.EJB 3InterceptorsIn terceptor.invok e(EJB3Intercept orsInterceptor. java:63)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. entity.Transact ionScopedEntity ManagerIntercep tor.invoke(Tran sactionScopedEn tityManagerInte rceptor.java:54 )
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.ejb3. AllowedOperatio nsInterceptor.i nvoke(AllowedOp erationsInterce ptor.java:47)
at org.jboss.aop.j oinpoint.Method Invocation.invo keNext(MethodIn vocation.java:1 01)
at org.jboss.aspec ts.tx.TxPolicy. invokeInOurTx(T xPolicy.java:79 )
... 50 more
Caused by: org.hibernate.t ype.Serializati onException: could not serialize
at org.hibernate.u til.Serializati onHelper.serial ize(Serializati onHelper.java:1 58)
at org.hibernate.u til.Serializati onHelper.serial ize(Serializati onHelper.java:1 78)
at org.hibernate.t ype.Serializabl eType.toBytes(S erializableType .java:74)
at org.hibernate.t ype.Serializabl eType.toString( SerializableTyp e.java:58)
at org.hibernate.t ype.NullableTyp e.nullSafeSet(N ullableType.jav a:87)
at org.hibernate.t ype.NullableTyp e.nullSafeSet(N ullableType.jav a:65)
at org.hibernate.l oader.Loader.bi ndNamedParamete rs(Loader.java: 1748)
at org.hibernate.l oader.Loader.pr epareQueryState ment(Loader.jav a:1577)
at org.hibernate.l oader.Loader.do Query(Loader.ja va:661)
at org.hibernate.l oader.Loader.do QueryAndInitial izeNonLazyColle ctions(Loader.j ava:224)
at org.hibernate.l oader.Loader.do List(Loader.jav a:2145)
at org.hibernate.l oader.Loader.li stIgnoreQueryCa che(Loader.java :2029)
at org.hibernate.l oader.Loader.li st(Loader.java: 2024)
at org.hibernate.l oader.custom.Cu stomLoader.list (CustomLoader.j ava:118)
at org.hibernate.i mpl.SessionImpl .listCustomQuer y(SessionImpl.j ava:1684)
at org.hibernate.i mpl.AbstractSes sionImpl.list(A bstractSessionI mpl.java:142)
at org.hibernate.i mpl.SQLQueryImp l.list(SQLQuery Impl.java:164)
at org.hibernate.e jb.QueryImpl.ge tResultList(Que ryImpl.java:53)
... 64 more
Caused by: java.io.NotSeri alizableExcepti on: oracle.jdbc.dri ver.T4CConnecti on
at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
at java.io.ObjectO utputStream.def aultWriteFields (Unknown Source)
at java.io.ObjectO utputStream.wri teSerialData(Un known Source)
at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
at java.io.ObjectO utputStream.wri teObject(Unknow n Source)
at org.hibernate.u til.Serializati onHelper.serial ize(Serializati onHelper.java:1 54)
... 81 more
The exception occurs when the return statement of the getFlightBaggag eSummary method is called. I'm a bit stuck to be honest. I'm converting a java array of Longs to an Oracle ARRAY object but it doesn't seem to work. I can't figure out from the exception where could be the problem.
The Oracle stored function takes a parameter of type FLIGHT_LIST.
The type is defined as follows:
create or replace TYPE flight_list AS TABLE OF NUMBER(10)
Could anyone tell me if there is a way to pass my Long[] and set the named parameter of the named native query? I managed to get it working with plain JDBC and a Callable Statement but I'd like to do it with an entity mapping.
Thanks in advance for any help.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: JWM |
last post by:
I am trying to implement Oracle connection pooling for the following code,
which was written by someone else. Here is my main question -- this java
file creates code that is executed every hour, but once per week, the oracle
server is brought down for backup. At that time, I get an error that looks
like I have the wrong credentials for the database. For every subsequent
attempt to run the hourly process, I am getting a broken pipe error,...
|
by: Jan van Veldhuizen |
last post by:
The UPDATE table FROM syntax is not supported by Oracle.
I am looking for a syntax that is understood by both Oracle and SqlServer.
Example:
Table1:
id name city city_id
1 john newyork null
|
by: Vincent Lefevre |
last post by:
I would like to know if the base URI considered to resolve an unparsed
entity defined by a relative URI should be the URI before or after its
rewriting due to a possible catalog.
Let's take an example. Here's my XML file:
<?xml version="1.0"?>
<!DOCTYPE para
PUBLIC "-//Norman Walsh//DTD Website Full V2.4.0//EN"
"http://docbook.sourceforge.net/release/website/2.4.0/website-full.dtd"
|
by: danbredy |
last post by:
Hi,
I'm attempting to connect to an Oracle database using SQL Server 2005
Express (OS is Windows XP Professional) and having absolutely no luck.
Here is the information SQL Plus
gives me about the database when I log in -
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
|
by: Jean-François Michaud |
last post by:
Hello all,
I'm having a little problem, The UTF-8 parser we are using converts the
newline entity (
) within an attribute that we are using to paliate
CSS limitations.
After the parser has gone through the document, the entity is converted
to \n, which then effectively tosses out the window the behavior we are
getting by keepinig the entity AS IS within the document.
| |
by: --CELKO-- |
last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any
kind of tools for this?
|
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= |
last post by:
Hi Willy,
Thank you very much for your work.
C++ code doesnot make any serialization.
So at runtime C# code gives an serialization error at
"msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"
I thought that it is very hard to memory map structure array.
I need both read and write memory mapped file at both side of C# and C++.
|
by: chris.kennedy |
last post by:
I am really struggling to create an entity which maps to 2 "base"
entities. I have a customer and invoice entity which are based in
tables in a one to many relationship. I have tried:
1. Creating a Invoice Entity based on the Invoice and adding a mapping
to both tables: I can't validate the model it says "Two entities with
different keys are mapped to the same row. Ensure these two mapping
fragments do not map two groups of entities with...
|
by: markla |
last post by:
Hi,
I have an Entity data model built in Entity Framework, which sources data
primarily from an MS SQL 2008 database, and sources some static (data
dictionary) values from code-based objects. I know I *could* store the data
dict values in SQL: for various reasons that's not the path I want to take.
I have some lookups, which are based on code-based Objects. They are
encapsulated in Objects because the values can change during...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |