Skip to main content
Filter by
Sorted by
Tagged with
1278 votes
14 answers
1.4m views

I really want to know more about the update, export and the values that could be given to hibernate.hbm2ddl.auto I need to know when to use the update and when not? And what is the alternative? These ...
user avatar
759 votes
18 answers
818k views

What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API?
leon's user avatar
  • 10.4k
646 votes
9 answers
639k views

What is the difference between: @Entity public class Company { @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY) @JoinColumn(name = "companyIdRef", referencedColumnName ...
Mykhaylo Adamovych's user avatar
595 votes
15 answers
269k views

What is the difference between Data Access Objects (DAO) and Repository patterns? I am developing an application using Enterprise Java Beans (EJB3), Hibernate ORM as infrastructure, and Domain-Driven ...
Thurein's user avatar
  • 6,975
555 votes
25 answers
744k views

I want to log SQL statements to a file. I have the following properties in application.properties: spring.datasource.url=... spring.datasource.username=user spring.datasource.password=1234 spring....
Oleg Pavliv's user avatar
  • 21.3k
446 votes
5 answers
680k views

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 will ...
Tommaso Taruffi's user avatar
398 votes
10 answers
347k views

I'm essentially looking for a "@Ignore" type annotation with which I can stop a particular field from being persisted. How can this be achieved?
m2o's user avatar
  • 6,774
387 votes
34 answers
426k views

I'm having the following issue when trying to update my entity: "A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance". I have a parent entity and it ...
axcdnt's user avatar
  • 14.7k
362 votes
27 answers
760k views

I have a JPA-persisted object model that contains a many-to-one relationship: an Account has many Transactions. A Transaction has one Account. Here's a snippet of the code: @Entity public class ...
Paul Sanwald's user avatar
  • 11.4k
333 votes
6 answers
605k views

I was working on my Spring boot app project and noticed that, sometimes there is a connection time out error to my Database on another server(SQL Server). This happens specially when I try to do some ...
moethata's user avatar
  • 3,647
318 votes
8 answers
185k views

I am new to Hibernate and I'm not sure whether to use a Hibernate SessionFactory or a JPA EntityManagerFactory to create a Hibernate Session. What is the difference between these two? What are the ...
elpisu's user avatar
  • 3,185
315 votes
22 answers
164k views

What are the pros and cons of using Criteria or HQL? The Criteria API is a nice object-oriented way to express queries in Hibernate, but sometimes Criteria Queries are more difficult to understand/...
cretzel's user avatar
  • 20.2k
274 votes
14 answers
412k views

In Hibernate 3, is there a way to do the equivalent of the following MySQL limit in HQL? select * from a_table order by a_table_column desc limit 0, 20; I don't want to use setMaxResults if possible. ...
stevedbrown's user avatar
  • 8,944
270 votes
5 answers
194k views

When they appear on a field/getter of an @Entity, what is the difference between them? (I persist the Entity through Hibernate). What framework and/or specification each one of them belongs to? @...
rapt's user avatar
  • 12.3k
264 votes
7 answers
199k views

Can anyone explain in simple words what First and Second Level caching in Hibernate/NHibernate are?
suhair's user avatar
  • 11k
246 votes
8 answers
459k views

In this code, how to generate a Java class for the composite key (how to composite key in hibernate): create table Time ( levelStation int(15) not null, src varchar(100) not null, dst ...
kaaf's user avatar
  • 2,461
242 votes
8 answers
249k views

For example, if we have a table Books, how would we count total number of book records with hibernate?
craftsman's user avatar
  • 15.7k
229 votes
8 answers
235k views

Ok so this is probably a trivial question but I'm having trouble visualizing and understanding the differences and when to use each. I'm also a little unclear as to how concepts like uni-directional ...
Ian Dallas's user avatar
  • 12.8k
224 votes
3 answers
223k views

I thought hibernate takes into consideration only instance variables that are annotated with @Column. But strangely today when I added a variable (that is not mapped to any column, just a variable i ...
hese's user avatar
  • 3,437
222 votes
7 answers
252k views

I am new to hibernate and need to use one-to-many and many-to-one relations. It is a bi-directional relationship in my objects, so that I can traverse from either direction. mappedBy is the ...
brainydexter's user avatar
  • 20.5k
216 votes
8 answers
164k views

What is the difference between using a @OneToMany and @ElementCollection annotation since both work on the one-to-many relationship?
n_g's user avatar
  • 3,595
212 votes
5 answers
67k views

What exactly does the owning side mean? What is an explanation with some mapping examples (one to many, one to one, many to one)? The following text is an excerpt from the description of @OneToOne in ...
Just a learner's user avatar
212 votes
10 answers
128k views

Hibernate has a handful of methods that, one way or another, takes your object and puts it into the database. What are the differences between them, when to use which, and why isn't there just one ...
Henrik Paul's user avatar
207 votes
4 answers
175k views

What is the difference between Unidirectional and Bidirectional associations? Since the table generated in the db are all the same,so the only difference I found is that each side of the bidiretional ...
hguser's user avatar
  • 36.2k
197 votes
10 answers
252k views

Can anyone tell me what's the advantage of persist() vs save() in Hibernate?
Anthony's user avatar
  • 12.9k

1
2 3 4 5
1903