Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
s_guodong
gjjs-bd-common
Commits
329a531c
Commit
329a531c
authored
Sep 21, 2023
by
吴佳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
多表readset查询CLOB类型报错修复
parent
b370961e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletions
+19
-1
MyBatisDaoSession.java
...com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
+19
-1
No files found.
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
View file @
329a531c
...
...
@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.io.Reader
;
import
java.io.Serializable
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
...
...
@@ -307,7 +308,24 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
if
(
field
.
getType
().
getName
().
equals
(
"java.lang.Integer"
)
&&
fieldVal
instanceof
BigDecimal
)
{
method
.
invoke
(
module
,
((
BigDecimal
)
fieldVal
).
intValue
());
}
else
{
method
.
invoke
(
module
,
fieldVal
);
//如果是CLOB类型的数据,将数据转换为String
if
(
fieldVal
instanceof
oracle
.
sql
.
CLOB
){
try
(
Reader
rsReader
=
((
oracle
.
sql
.
CLOB
)
fieldVal
).
getCharacterStream
()){
char
[]
chs
=
new
char
[
2048
];
StringBuffer
sb
=
new
StringBuffer
();
int
i
=
0
;
while
((
i
=
rsReader
.
read
(
chs
))!=-
1
)
{
sb
.
append
(
chs
,
0
,
i
);
}
System
.
out
.
println
(
"clob to string >>"
+
sb
.
toString
());
method
.
invoke
(
module
,
sb
.
toString
());
}
catch
(
Exception
e
)
{
log
.
error
(
"执行方法{}时CLOB类型数据转String异常"
,
methodName
);
}
}
else
{
method
.
invoke
(
module
,
fieldVal
);
}
}
}
}
catch
(
InvocationTargetException
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment