Tagged Questions
82
votes
5answers
53k views
Hibernate show real SQL [duplicate]
if I set
<property name="show_sql">true</property>
in my hibernate.cfg.xml configuration file in the console I can see the SQL.
But it's not real SQL... Can I see the SQL code that ...
39
votes
7answers
23k views
Print query string in hibernate with parameter values
Is it possible in hibernate to print generated sql queries with real values instead of question marks?
How would you suggest to print queries with real values if its not possible with hibernate api?
30
votes
8answers
35k views
Case-insensitive search using Hibernate
I'm using Hibernate for ORM of my Java app to an Oracle database (not that the database vendor matters, we may switch to another database one day), and I want to retrieve objects from the database ...
20
votes
5answers
22k views
How to get SQL from Hibernate Criteria API (*not* for logging)
is there an easy way to get the (to-be-generated) sql from a Hibernate Criteria?
Ideally I would have something like:
Criteria criteria = session.createCriteria(Operator.class);
... build up the ...
19
votes
6answers
42k views
Hibernate Union alternatives
What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view ...
14
votes
9answers
4k views
Hibernate authentication without passwords stored in plain text
My goal is to authenticate to the database using a JDBC/Hibernate in a secure manner, without storing passwords in plain text. Code examples appreciated. I'm already using waffle to authenticate the ...
14
votes
3answers
1k views
Hibernate produce different SQL for every query
I've just tested my application under the profiler and found out that sql strings use about 30% of my memory! This is bizarre.
There are a lot of strings like this stored in app memory. This is SQL ...
13
votes
2answers
253 views
Hibernate faster EntityManagerFactory creation
In my desktop application new databases get opened quite often. I use Hibernate/JPA as an ORM.
The problem is, creating the EntityManagerFactory is quite slow, taking about 5-6 Seconds on a fast ...
9
votes
2answers
4k views
How is SQL injection typically stopped in a Spring/Hibernate setup
I hate the Ruby language because it's not statically typed but the more time I spend with Spring/Hibernate I appreciate more of Ruby on Rails' features. Specifically the fact that their Active Record ...
9
votes
3answers
6k views
Using sum() in hibernate criteria
How can I write the sql query select sum(amount * direction) from transactions into hibernate criteria ?
8
votes
2answers
3k views
Why is it recommended to avoid unidirectional one-to-many association on a foreign key? [duplicate]
Possible Duplicate:
Hibernate unidirectional one to many association - why is a join table better?
In the Hibernate online documentation, under section 7.2.3 One-to-many, it's mentioned, ...
8
votes
3answers
8k views
Get column name of property mapped with Hibernate
How can I access the Hibernate mapping of my model to find out the column name of a property?
The column name is not specified in the mapping so Hibernate generates it automatically - I would like ...
8
votes
2answers
3k views
Ant task for generating ER diagram from JPA/Hibernate annotated classes
Does anyone know of a tool that can do that?
Linguine maps seems to only work on old hibernate xml files. And the hibernate tool task hbm2hbmxml seems to have a bug so that I can't do the two step ...
8
votes
5answers
222 views
rewrite Hibernate query without huge list parameter
In my database I have a zip table with a code column. The user can upload a list of Zip codes and I need to figure out which ones are already in the database. Currently, I do this using the following ...
7
votes
2answers
4k views
java hibernate: selecting the discriminator column in polymorphic hql query
In hibernate, I want to select the discriminator value. Something like
select discriminator, id, name, age from Animal
The idea is to send the result of this query to the client side, so that I can ...