-->
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.  [ 1 post ] 
Author Message
 Post subject: How to map String to Oracle URITYPE?
PostPosted: Wed Feb 26, 2014 4:42 pm 
Newbie

Joined: Thu Feb 06, 2014 3:23 pm
Posts: 1
I'm creating an webapp that save a file to the server and stores the URI to an Oracle Database using Hibernate. The Column in the Database is `URITYPE`. My entity as of now is a String and changing the Database table isn't an option. Any help would be wonderful.

The old webapp used an annotation:

Code:
@JdbcControl.SQL(statement = INSERT INTO DOCUMENTS (DOCUMENT_URI) VALUES ( sys.UriFactory.getUri({document.document_URI})))


Here's my Stack Trace when I try to execute:
Code:
sessionFactory.getCurrentSession().save(document);

Code:
    Feb 27, 2014 11:21:11 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet [main] in context with path [/main] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into DOCUMENTS (DOCUMENT_URI, PRODUCT_CODE, STANDARD_CODE, DOCUMENT_NAME, DOCUMENT_CODE, DOCUMENT_APPLICATION) values (?, ?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update] with root cause
    java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected SYS.URITYPE got CHAR
   
       at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:345)
       at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10844)
       at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
       at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:262)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:178)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
       at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
       at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
       at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
       at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
       at my.app.main.HomeController$$EnhancerByCGLIB$$3aa13ee5.insertDocument(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
       at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
       at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
       at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
       at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
       at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
       at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:800)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       at my.app.main.filters.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:22)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
       at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
       at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
       at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
       at java.lang.Thread.run(Thread.java:744)


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

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.