-->
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.  [ 7 posts ] 
Author Message
 Post subject: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Mon Sep 12, 2016 9:49 pm 
Newbie

Joined: Mon Sep 12, 2016 9:40 pm
Posts: 4
Dear all,

I posted a question on the stackoverflow in the link: http://stackoverflow.com/questions/3940 ... -against-m.

The problem I met was that the generated Insert SQL statment came without any binding parameters. Please help to advice.

Quote:
[druid.sql.Statement ] {conn-110022, pstmt-125053, rs-155055} query executed. 6.067257 millis. select usertagrec0_.id as id20_, usertagrec0_.created_at as created2_20_, usertagrec0_.status as status20_, usertagrec0_.tag_name as tag4_20_, usertagrec0_.user_name as user5_20_ from user_tag_record usertagrec0_ where usertagrec0_.tag_name=? and usertagrec0_.user_name=?
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} open
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} Header: [id, created_at, status, tag_name, user_name]
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} closed
[druid.sql.Statement ] {conn-110022, pstmt-125053} closed
[org.hibernate.engine.internal.StatefulPersistenceContext] Initializing non-lazy collections
[service.tag.impl ] userName=wenxzhen;tagName=hadoop;status=1;createdAt=1473219014318
[org.hibernate.engine.spi.ActionQueue] Executing identity-insert immediately
[druid.sql.Statement ] {conn-110022, pstmt-125056} created. insert into user_tag_record values ( )
[org.hibernate.SQL ] insert into user_tag_record values ( )
[druid.sql.Statement ] {conn-110022, pstmt-125056} Parameters : []
[druid.sql.Statement ] {conn-110022, pstmt-125056} Types : []
[druid.sql.Statement ] {conn-110022, pstmt-125056} update executed. effort 1. 5.189083 millis. insert into user_tag_record values ( )
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} open
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} Header: [GENERATED_KEY]
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} Result: [254096]
[org.hibernate.id.IdentifierGeneratorHelper] Natively generated identity: 254096
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} closed


Thank you very much,
Best, Wenxing


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Tue Sep 13, 2016 4:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I added a comment on the StackOverflow question. Let's continue it there.


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Sat Sep 17, 2016 9:28 pm 
Newbie

Joined: Mon Sep 12, 2016 9:40 pm
Posts: 4
Updated on the stackoverflow, please kindly shed some lights.

mihalcea_vlad wrote:
I added a comment on the StackOverflow question. Let's continue it there.


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Sun Sep 18, 2016 3:36 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You still didn't add the entities.


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Mon Nov 07, 2016 11:14 pm 
Newbie

Joined: Mon Sep 12, 2016 9:40 pm
Posts: 4
On this problem, I have a revisit today. And find some weird things:

From the test bed:
[service.tag.impl ] userName=wenxzhen;tagName=hadoop;status=1;createdAt=1478615472986
...
[org.apache.commons.beanutils.converters.ArrayConverter] Converting 'java.net.URL[]' value '[Ljava.net.URL;@5d975bc5' to type 'java.net.URL[]'
[org.apache.commons.beanutils.converters.ArrayConverter] No conversion required, value is already a java.net.URL[]
[org.apache.commons.beanutils.converters.LongConverter] Converting 'Long' value '1478615472986' to type 'Long'
[org.apache.commons.beanutils.converters.LongConverter] No conversion required, value is already a Long
[org.apache.commons.beanutils.ConvertUtils] Convert string 'hadoop' to class 'java.lang.String'
[org.apache.commons.beanutils.converters.StringConverter] Converting 'String' value 'hadoop' to type 'String'
[org.apache.commons.beanutils.ConvertUtils] Convert string 'wenxzhen' to class 'java.lang.String'
[org.apache.commons.beanutils.converters.StringConverter] Converting 'String' value 'wenxzhen' to type 'String
'

[org.hibernate.engine.spi.ActionQueue] Executing identity-insert immediately
[druid.sql.Statement ] {conn-110030, pstmt-120003} created. insert into user_tag_record (created_at, status, tag_name, user_name) values (?, ?, ?, ?)
[org.hibernate.SQL ] insert into user_tag_record (created_at, status, tag_name, user_name) values (?, ?, ?, ?)

From the production box:
[service.tag.impl ] userName=wenxzhen;tagName=java;status=1;createdAt=1478571296820
...
[org.apache.commons.beanutils.converters.ArrayConverter] No conversion required, value is already a java.net.URL[]
[org.hibernate.engine.spi.ActionQueue] Executing identity-insert immediately
[druid.sql.Statement ] {conn-110030, pstmt-120002} created. insert into user_tag_record values ( )
[org.hibernate.SQL ] insert into user_tag_record values ( )
[druid.sql.Statement ] {conn-110030, pstmt-120002} Parameters : []
[druid.sql.Statement ] {conn-110030, pstmt-120002} Types : []

We can see the difference, but I didn't know how it happened? Please help to advice.


wenxzhen wrote:
Dear all,

I posted a question on the stackoverflow in the link: http://stackoverflow.com/questions/3940 ... -against-m.

The problem I met was that the generated Insert SQL statment came without any binding parameters. Please help to advice.

Quote:
[druid.sql.Statement ] {conn-110022, pstmt-125053, rs-155055} query executed. 6.067257 millis. select usertagrec0_.id as id20_, usertagrec0_.created_at as created2_20_, usertagrec0_.status as status20_, usertagrec0_.tag_name as tag4_20_, usertagrec0_.user_name as user5_20_ from user_tag_record usertagrec0_ where usertagrec0_.tag_name=? and usertagrec0_.user_name=?
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} open
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} Header: [id, created_at, status, tag_name, user_name]
[druid.sql.ResultSet ] {conn-110022, pstmt-125053, rs-155055} closed
[druid.sql.Statement ] {conn-110022, pstmt-125053} closed
[org.hibernate.engine.internal.StatefulPersistenceContext] Initializing non-lazy collections
[service.tag.impl ] userName=wenxzhen;tagName=hadoop;status=1;createdAt=1473219014318
[org.hibernate.engine.spi.ActionQueue] Executing identity-insert immediately
[druid.sql.Statement ] {conn-110022, pstmt-125056} created. insert into user_tag_record values ( )
[org.hibernate.SQL ] insert into user_tag_record values ( )
[druid.sql.Statement ] {conn-110022, pstmt-125056} Parameters : []
[druid.sql.Statement ] {conn-110022, pstmt-125056} Types : []
[druid.sql.Statement ] {conn-110022, pstmt-125056} update executed. effort 1. 5.189083 millis. insert into user_tag_record values ( )
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} open
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} Header: [GENERATED_KEY]
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} Result: [254096]
[org.hibernate.id.IdentifierGeneratorHelper] Natively generated identity: 254096
[druid.sql.ResultSet ] {conn-110022, pstmt-125056, rs-155056} closed


Thank you very much,
Best, Wenxing


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Tue Nov 08, 2016 6:04 am 
Newbie

Joined: Mon Sep 12, 2016 9:40 pm
Posts: 4
Find the problem lies in the following codes:
//dependency/commons-beanutils-1.8.0.jar
public void setProperty(Object bean, String name, Object value)
throws IllegalAccessException, InvocationTargetException {
if (target instanceof DynaBean) {
DynaClass dynaClass = ((DynaBean) target).getDynaClass();
DynaProperty dynaProperty = dynaClass.getDynaProperty(propName);
if (dynaProperty == null) {
return; // Skip this property setter
}
}

The property can't be set on JDK:
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)


After upgrading the JDK to newer version:
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)


The issue fixed.


Top
 Profile  
 
 Post subject: Re: Hibernate - no binding and values for generated “Insert” SQL
PostPosted: Tue Nov 08, 2016 6:08 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
That's not even Hibernate code. You should log more details in your application so that you can better understand what's happening.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.