Using BC4J, Cannot Cast an Oracle Number to a java int
Hi,
I am using bc4j in jdev 9i, version 9.0.2.822. I have a type Row, to get the data from oracle, bc4j, and all work fine, except that I cannot
cast or convert the number returned to an int where I can use it for other java functions.
Is there any way to convert the number, using a wrapper or a function to do so?
Any help is greatly appreciated.
Use Number.intValue() method.
Similar Messages
-
Trouble using getLong to get an Oracle Number(8,2) field from ResultSet
I am having trouble using getLong to get an Oracle Number(8,2) field from ResultSet. The error message starts with:
java.lang.ExceptionInInitializerError: [exception was kaffe.utilNotImplemented] at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(....
and similar messages when I try getString, getDouble, etc. I am able to getString on the VARCHAR and DATE fields but have not been able to access the NUMBER(8,2) fields.java.lang.ExceptionInInitializerError: [exception was
kaffe.utilNotImplemented] at
oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong(...
kaffe.utilNotImplemented may be being thrown internally by your JDK.. AFAIK the Kaffe JDK is only JAVA 1.1 compatible and your driver may require JAVA 2.
Col -
Hi,
I have a Oracle field configured as NUMBER(38). The number in that field gets incremented sequentially and is currently around 5345232341.
I am using callableStatement.registerOutParameter(1,java.sql.Types.INTEGER); which is working fine.
But the problem happens when I am trying to retrieve the value and store it within my Program.
I am using 'long' to do that but I presume I will hit a problem when the number crosses 9223372036854775807 (2^63-1). As we don't have unsigned long option in Java(unlike in C/C++), how do we achieve this? Please can somebpdy tell me the workaround.
Currently, I am storing it as follows:
long my_number = callableStatement.getInt(1);Currently, I am storing it as follows:
long my_number = callableStatement.getInt(1);While reading the docs, you should probably also read about getInt(), because your current code is buggy. -
What is the benefit of using BC4J?
Folks,
After working with BC4J for three months, I still can not convince my manager to use BC4J. His major arguments are:
1. Which applications or web sites are implemented using BC4J? Are they real application or just a demo. For the time being, I even can not show him a demo, not to say any real web applications.
2. His developers told him that the O-R mapping provided by BC4J, which is probabably one of the key benefit of BC4J can be easily coded manually with a couple of days work for the current task and we have the full control over our own code while BC4J is not an open source and the lack of the support from Oracle really worries him.
Can someone in Jdev team give me a clear evidence to convince him?
Thanks,
Yibing[list]
[*]With regard to struts integration with BC4J, I have done some investigations of the new release and know that BC4JActionForm is only good for simple view and does not work for a joint table view as I have reported a few days ago in this group and no response is received yet.
This should not be the case. Should work for any view object. View objects can contain join queries with any number of updateable tables in them. Please email me the URL to the forum posting so I can track down the issue.
[*]I have been recently told indirectly from Oracle that the consulting group at oracle are not using BC4J and instead they think that BC4J only applies to simple applications with limited number of tables and relationships.
This is plain incorrect. We have very large applications using BC4J both internal in Oracle Applications, for Oracle iLearning, and many external customers. Many of these projects have involved (and are currently involving) Oracle Consulting. Not sure where got this information, but it is incorrect.
[*]Other commecial O-R mapping products such as top-link should be used for large applications
The key difference between Oracle9i TopLink and Oracle9i BC4J has nothing to do with the size of your project. The fundamental difference is that toplink is for customers who have already written a custom application framework and who require just a persistence architecture, because they've already hand-written code to implement all of the other J2EE design patterns that are required to build real J2EE applications.
Conversely, BC4J is for customers who want a complete J2EE Application Framework (and tightly integrated, award-winning toolset to go with it) to avoid having to write, test, debug, and maintain their own application framework.
There is simply no evidence to backup your statement that BC4J only works for small applications. I am aware of at least 20 (and by now after a summer full of training additional Oracle Apps development teams in BC4J, perhaps over 30) that are using BC4J for full-scale, self-service J2EE web applications. Our BC4J reference info pages (link in this thread above) have references to customers who are using BC4J for large applications as well.
[list]
Hope this helps. -
Hi Experts,
i need to map sourse type as decimal with target type also decimal. in the mapping logic i need perform arthemetic logic like exchange rate=exchangerate*sourceunit/targetunit
i mapped as per the logic but i tested in display queue i am getting this below error
Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Cannot cast '' to decimal number] in class com.sap.aii.mappingtool.flib7.Arithm method mul[, , com.sap.aii.mappingtool.tf7.rt.Context@13133cec] See error logs for details
is this required to use UDF to perform my logic. if it required please suggest me the UDF.
thanks,
pavan
Edited by: Pavan Kumar Thiruveedula on Dec 19, 2011 7:12 AMEnter the value in test tab for the field and then check Display queue.
i Guess you are testing with blank value -
Cannot cast boolean to BigDicemal??
i am new in reporting
i am using iReport 3.0...
i want to show my line in report if a field value is greater than 5000
my field type is BigDecimal
i wrote formula as
(($F{AvgAmount}.intValue() >= 5000 )? true : false )
when i check expression result is Expression successfully validated.
when i Run report error accour
Errors compiling .\BranchWiseAverage.jasper.
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <---------------------------------------------------------------------------------------------------------------> 2. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getOldValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <------------------------------------------------------------------------------------------------------------------> 3. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <---------------------------------------------------------------------------------------------------------------> 3 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:591) at java.lang.Thread.run(Unknown Source)
Compilation running time: 328
how can i remove this error.
thanksHi Les,
where there is a will, there is a script:
Get-ADUser -Filter * -SearchBase "OU=Departments,dc=contoso,dc=com" -Properties * | select Name, @{ n = "Enabled"; e = { [int]$_.Enabled } }, Canon* | export-csv departments.csv
Cheers,
Fred
There's no place like 127.0.0.1 -
Hi friends,
We are in to new development in Oracle ADF and newbie to this technology.
Created .jsf page and in corresponding pagedef, has "ControllerClass" with refering "DummyPagePhaseListener" and we have master-detail relationship using Viewlink(created using a SQL Query and entity based view).
Below exception raised when navigating from one to another record in Master af:table. Any help will be appreciated. Thanks in Advance......
java.lang.ClassCastException: DummyPagePhaseListener cannot be cast to oracle.adf.model.RegionController
at oracle.adf.model.binding.DCBindingContainer.getRegionController(DCBindingContainer.java:5197)
at oracle.adf.model.binding.DCBindingContainer.validate(DCBindingContainer.java:4247)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.validateModelUpdates(PageLifecycleImpl.java:300)
at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.validateModelUpdates(FacesPageLifecycle.java:70)
at oracle.adf.controller.v2.lifecycle.Lifecycle$6.execute(Lifecycle.java:202)
at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:197)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$600(ADFPhaseListener.java:23)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$3.after(ADFPhaseListener.java:323)
at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:75)
at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.afterPhase(ADFLifecyclePhaseListener.java:53)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:447)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)Hi timo,
Thanks for ur reply...
we are using unbounded taskflow.
In Controller class(page def file), we refered the class that implements PagePhaseListener
The following override methods has created
public void afterPhase(PagePhaseEvent pagePhaseEvent) {
//In this area we used to read the session object file which is written and sent by another application(application to application navigate).
If session object file exists,will allow the user to navigate into the requested page else will navigate in to login(security aspect).
public void beforePhase(PagePhaseEvent pagePhaseEvent) {
Is we used Controller class wrongly ???
Is there any relationship with region controller???
Mani
[email protected] -
Hi All,
i am using jdev version 11.1.1.5.0
and deployed my Adf application on Apache Tomcat 6.0.
in my use case i have created simple adf application using adf business component. create a vo based on eo and drag-drop on jspx page.
i have created JNDI data source in Apache server using edit context.xml file and add following line-
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:dst"
username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
maxWait="-1" accessToUnderlyingConnectionAllowed="true" />
3.using same data source in my adf applicatioin as -
right click on AM --> Configuration-->edit-->select connection type jdbc datasource -->java:/comp/env/jdbc/TestDB
4. after that i have deployed my application on apace server but when i have running application i have got following error-
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
i have goggling and find following solution-
oracle.jdbc.driver.OracleConnection delConn = (oracle.jdbc.driver.OracleConnection) ((org.apache.tomcat.dbcp.dbcp.DelegatingConnection)c_stmt.getConnection()).getDelegate();
but my problem is that i'm using Adf Business Component so where i set following type casting.
Is there any method on ADF BC which handle JNDI Data source setting or any other way to do this.
thanks in Advance
ManishHi dvohra21,
thanks for reply.
i don't understand where i go to set accessToUnderlyingConnectionAllowed =true
i have already set this property on context.xml file
<Resource name="jdbc/TestDB" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:dst"
username="jagrandb" password="jagrantest" maxActive="20" maxIdle="10"
maxWait="-1" accessToUnderlyingConnectionAllowed="true" />
any other place where i set this propery
please elaborate this steps how to Configuree DBCP -
HI ,
I'm using ADF 11g,
I'm working on individual work space. i have used oracle.adf.model.binding.DCControlBinding in my bean class and working fine .Now one day before i have taken svn version repository project and started working .I made simple jspx with adf table and tool bar button such as Add. When i fire add button i'm calling a method in bean class.
public String createRecord() {
// Add event code here... bank_add
System.out.println("-- create record --");
BindingContainer bindings2 = ADFUtils.getBindingContainer();
DCControlBinding dcc = (DCControlBinding)bindings2.get("XbtBankSettlementVOIterator");
return "banksettlement_add";
surprisingly i got this error.when my fellow colleague is using same svn repository project and using oracle.adf.model.binding.DCControlBinding it is working fine.
but why i'm getting this error below.i have followed the same steps to create View Object and Entity Object as previous .
<ActionListenerImpl><processAction> java.lang.ClassCastException: oracle.jbo.uicli.binding.JUIteratorBinding cannot be cast to oracle.adf.model.binding.DCControlBinding
javax.faces.el.EvaluationException: java.lang.ClassCastException: oracle.jbo.uicli.binding.JUIteratorBinding cannot be cast to oracle.adf.model.binding.DCControlBinding
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:90)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:309)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:94)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:90)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:309)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:94)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:812)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:292)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:326)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: java.lang.ClassCastException: oracle.jbo.uicli.binding.JUIteratorBinding cannot be cast to oracle.adf.model.binding.DCControlBinding
at com.agile.xb.view.managed.BankSettlementDtlBean.createRecord(BankSettlementDtlBean.java:32)
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:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 51 more
thanks in advanceHi Frank,
I know that JUIteratorBinding is taking ,but how can i change and where could i find . I have import operation binding in my bean and creation of VO and EO object time as i did noraml way .
sorry can i get some more information.
thanks in advance . -
Oracle.sql.STRUCT cannot be cast to oracle.sql.STRUCT
I met a problem,I use oracle spatial to store geometry,then get it like this:
STRUCT dbObject = (oracle.sql.STRUCT)rs.getObject("shape");
JGeometry geom = JGeometry.load(dbObject);
tomcat 6 told me java.lang.ClassCastException: oracle.sql.STRUCT cannot be cast to oracle.sql.STRUCT
does everyone knows this problem?thanks
Edited by: 811014 on 2010-11-13 下午9:28
Edited by: 811014 on 2010-11-13 下午9:28Hi, this is a known problem for most Spatial 10g Java APIs with WLS.
WLS is only certified with 11g DB.
Instead of using Weblogic JNDI Lookup for Datasource, try the following snippet to create your connection/datasource (with Oracle JDBC thin driver):
String databaseUrl = jdbc:oracle:thin:@1.2.3.4:1521:yourdbname
String databaseUser = dbusername
String databasePassword = dbpassword
DriverManager.registerDriver(new OracleDriver());
Connection aConnection = DriverManager.getConnection(databaseUrl, databaseUser, databasePassword);
For more information, see the following:
Classcast Exception while using Oracle ARRAYs
regards,
jack -
Hi there,
I'm facing this exception.
My code:
final ReportTemplateAttachment rta = new ReportTemplateAttachment();
FileBlob fb = new FileBlob();
fb.setContentType(attachmentDto.getContentType().getValue());
fb.setCreationDate(sysDate);
fb.setCreationUser(userId);
final SerialBlob blob = new SerialBlob(attachmentDto.getFileVal());//it's a byte[]
//SerialBlob is of type javax.sql.rowset.serial.SerialBlob
fb.setFileData(blob);
fb.setName(attachmentDto.getFileName());
fb.setLastUpdateDate(sysDate);
fb.setLastUpdateUser(userId);
fb.setLength(blob.length());
rta.setFileBlob(fb);and the object rta will be inserted into another object.
The variable of interest in FileBlob hbm is defined as follows:
<property name="fileData" type="blob">
<column name="FILE_DATA" />
</property>where the type blob is oracle.sql.BLOB
If I change the oracle.sql.BLOB to javax.sql.rowset.serial.SerialBlob in the hbm, I can insert but when I try to get the blob back I get a deserialize exception so this change is not an option.
but when I save the main Object (a cascade operation) I get the following exception:
org.springframework.jdbc.UncategorizedSQLException:
Hibernate flushing: could not insert: [pt.sc.data.entities.FileBlob];
uncategorized SQLException for SQL
[insert into WP_ADMIN.file_blob (name, content_type, length, file_data, status, creation_user, creation_date, last_update_user, last_update_date, id)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)];
SQL state [null];
error code [0];
An SQLException was provoked by the following failure: java.lang.ClassCastException:
javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB;
nested exception is java.sql.SQLException: An SQLException was provoked by the following failure:
java.lang.ClassCastException: javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOBAny light on the subject?
Thanks in advance,
mleiriaYou don't seem to understand the difference between an object model and a database. Hibernate, being an ORM package, works on the object model and will, based on what you request it to do, generate proper SQL statements to get the database part going. But you shouldn't be thinking about databases when using Hibernate; your main focus is the object model. There is no blob, only binary data. Binary data in Java is generally handled through a byte array.
If you want to think in databases where blobs do exist, you should be using JDBC directly, not Hibernate.
(I'm far from being an expert in Hibernate)I would really suggest taking a few hours and reading through the manual. You don't need to be an expert but you should at least know what kind of tool you're working with. -
Hi all,
Please help -
I got this exception when try to retrieve a table row from my backing bean:
Caused by: java.lang.ClassCastException: oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding cannot be cast to oracle.jbo.uicli.binding.JUCtrlValueBindingRef
The line of code in the backing bean caused the error:
oracle.jbo.uicli.binding.JUCtrlValueBindingRef tableRowRef = (oracle.jbo.uicli.binding.JUCtrlValueBindingRef) this.getTable1().getRowData();
What bugs me is that the same code works fine in another page's backing bean (see *1) and I can't find out the difference.
My environment:
I am using JDeveloper 11. The application I am working on was migrated from a JDeveloper 10g app, so the components are mostly Trinidad. We had to do a lot adjustment to get that app to work in 11g. The working page I mentioned above was done in 10g app (*1).
I am now adding more things into this app. The app's setup is EJB session beans and Trinidad components now.
In the jspx page, I have a table which was made up with a view from the database (NOT VO). I have a command link in a column in that table, and would like to get a Id from the row in the table. The line of code causes error above is in the command link's action method.
Please help if you have any clue.
Thanks a lot!
Sophia
Edited by: user12876081 on Jan 12, 2011 2:40 PMThank you so much Frank! It's just that simple. This is my first post question, although I had always looked up the forum for answers before. I am a big fan of yours. This is such a great experience on my first post. I am having a much better day than yesterday. :-) Thanks again!
-
Hi,
Please help me to understand why this error comes.
I have deployed ear file into glass fish server.
Using adf essential in Jdevelepor 11.1.2.3.0.
[#|2012-12-04T19:17:51.658+0530|INFO|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=21;_ThreadName=Thread-2;|PWC1412: WebModule[null] ServletContext.log():JspServlet error: Servlet unable to dispatch to the following requested page: The following exception occurred:java.lang.ClassCastException: java.lang.String cannot be cast to oracle.adf.view.rich.model.RegionModel|#]
[#|2012-12-04T19:17:51.658+0530|INFO|glassfish3.1.2|oracle.j2ee.jsp|_ThreadID=21;_ThreadName=Thread-2;|unable to dispatch JSP page: The following exception occurred:.
java.lang.ClassCastException: java.lang.String cannot be cast to oracle.adf.view.rich.model.RegionModel
at oracle.adf.view.rich.component.fragment.UIXRegion.getValue(UIXRegion.java:1587)
at oracle.adf.view.rich.component.fragment.UIXRegion.getRegionModel(UIXRegion.java:415)
at oracle.adfinternal.view.faces.taglib.region.RegionTag.doStartTag(RegionTag.java:107)
at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
at oracle.jsp.runtime.tree.OracleJspIterationTagNode.executeHandler(OracleJspIterationTagNode.java:45)
at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
Thanks for the help in advance..It seems you have used a taskflow on a page and one of the binding.
It will be easy to point out if you paste the code of region tag *<af:region.......*. -
I recently upgraded my IPhone and for 1 person I began receiving this "7233375 Error Invalid Number. Please re-send using a valid 10 digit mobile number or valid short code". I receive text from this person but cannot send. Please help. Thank you.
Hi there
I’d be happy to help with this messaging error! This will be due to the device storing the number incorrectly. Please do the following to resolve the issue:
Delete texts from both old number and new
Delete any call logs including these numbers
Delete old number from contacts
Delete new number from contacts
Restart device
Send text to the new number directly (do not save as contact)
Once the text sends successfully, you can then save as a new contact
I hope this helps!
Charise -
Hot to get the id of a topic added in previous jsp page using bc4j jbo tags
Do you want to use the value in a Java variable? If so then here's what you do:
1) Inside your rowset iterate tag, use the <jbo:Row> tag and set action="active". It will look like this:
<jbo:Row id="rowActive" datasource="ds" action="active" ></jbo:Row>
2) In script, you can access the attribute you want by calling rowActive.getAttribute(); ... One thing to note is that this returns an Object. You will need to type cast it before assignment. For example, say you are retrieving column Test of type Number...
<%
oracle.jbo.domain.Number tempNumber;
tempNumber = (oracle.jbo.domain.Number)rowActive.getAttribute("Test");
%>
Hope that helped!
Maybe you are looking for
-
How can I copy the date and time of a received email in Mountain Lion?
I recently installed the new Mountain Lion, however I am having a serious issue with the mail application. I use the mail application to download all of my emails and then I copy each one in to a Filemaker Database. I used to be able to copy the head
-
Audition has encountered an error.
I got this error message. how can i solve this? Audition has encountered an error. [\premiere2.0\Backend\Src\Core\Preferences.cpp-253] and this message box also popup. Shutting Down... To continue working where you left off, please restart Audition.
-
Hi, I required a report with purchase order GR/ IR postings and vendor account how much paid to vendor and out standing balance What tables is required how can I develop report Please help me it is very urgent I will assign points Thanks Radha
-
FlasCC SWC freezes FB 4.7
I have a 1.5 MB SWC created using FlasCC. When I add this SWC to my project, FB 4.7 becomes unresponsive for a couple of minutes. When I close it and then re-open it, it becomes unresponsive for four minutes. After it finally opens, the auto-complete
-
I have Trouble with Terminal.
I have on my desktop a cdr file called Japanese 1-4.cdr. I read online that I can use terminal to make an iso hybrid using this code. cd ~/Desktop hdiutil makehybrid -iso -joliet -o Japanese 1-4.iso Japanese 1-4.cdr But whenever I put it into Termina