Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save QueryString as String ?

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With



all sql-statements are printed to my console. This is fine.

But how can I save that sql-string in a common String value?

Something like:


Any Ideas??
 
M K Rayapudi
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
configure a file appender
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have to configure a FileAppender (via log4j),
write the query statements to that file and read that statements from the file again?

Not very conveniently? Is there no other way to get the string value (what Hibernate, JPA) in a direct way?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use a FileAppender? Just write a custom appender and have that communicate with your code.

There is no way to get Hibernate to do this for you. Doing anything (beyond logging) with the SQL generated by your JPA implementation kind of doesn't make sense which is probably why there is no out the box way of doing it.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

custom file appender..I must admit I do not have great knowledge about such things..but I will learn

http://www.javaworld.com/javaworld/jw-12-2004/jw-1220-toolbox.html?page=1

thanks.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic