Questions tagged [hibernate]

An object-relational mapping (ORM) framework for the Java programming language.

85 questions
82
votes
6 answers

Service layer vs DAO -- Why both?

I have been working with SpringMVC, Hibernate, and some databases in a java web application example. There are a few different ones that do this, but this Spring 3 and hibernate integration tutorial with example has a model class, view (in jsp), and…
Jeff
  • 1,854
  • 3
  • 16
  • 19
37
votes
5 answers

What are the advantages of myBatis over Hibernate?

I've done some research on my own and understand the basic concept. But some insights can only be gained through actual experience. What are the advantages of myBatis that would make it worth learning a new framework? In what case would you avoid…
Kshitiz Sharma
  • 817
  • 4
  • 10
  • 14
19
votes
1 answer

Java application structure: Horizontal vs vertical split

Having a bit of a debate about the starting project structure (using Maven/Eclipse) for a big Java application. Option 1: entities (i.e. the whole database using Hibernate classes-first) services (i.e. sets of read/write operations on the…
Steve Chambers
  • 307
  • 2
  • 8
19
votes
5 answers

Do I need to know servlets and JSP to learn spring or hibernate or any other java web frameworks?

I've been asking a lot of people where to start learning java web development, I already know core java (Threading,Generics,Collections, a little experience with (JDBC)) but I do not know JSPs and servlets. I did my fair share of development with…
KyelJmD
  • 971
  • 5
  • 10
  • 20
12
votes
2 answers

Is Spring + Hibernate prefered instead of EJB 3?

It is my perception that whenever new JEE projects start (where these technologies would be applicable), people prefer to use a combination of Spring + Hibernate instead of EJB 3. It seems junior programmers are even advised to go for that instead…
JohnDoDo
  • 2,309
  • 2
  • 18
  • 32
9
votes
5 answers

How to design a complex REST API considering DB performance?

I've been following some tutorials on how to design REST APIs, but I still have some big questions marks. All these tutorials show resources with relatively simple hierarchies, and I would like to know how the principles used in those apply to a…
user3748908
  • 1,607
  • 2
  • 14
  • 15
9
votes
1 answer

IntelliJ with Maven compilation

I have a project that needs Hibernate jars. I added them as dependencies in the pom.xml and Maven compiles my project well. However, in the IDE, all annotations and calls to Hibernate API are marked as unresolved (red). How could I get IntelliJ…
Mik378
  • 3,838
  • 7
  • 33
  • 60
8
votes
1 answer

ORM: runtime proxies vs bytecode instrumentation

What are the benefits of using runtime proxies with an ORM provider like Hibernate or EclipseLink compared to bytecode instrumentation/enhancement? I know that bytecode instrumentation helps to optimize dirty checking. Because it can intercept…
Dragan Bozanovic
  • 257
  • 1
  • 12
7
votes
4 answers

Examples of mid/large-scale web-apps built without an ORM?

I've been reading a lot of hate spewed on ORMs, and am genuinely interested in finding out if there is a better way of doing things. Unfortunately, while there are tons of books, blog posts, and articles about modeling and building apps using…
Saurabh Nanda
  • 557
  • 4
  • 8
7
votes
3 answers

Best way to deal with Hibernate 1->Many relationship over REST/JSON service

Problem: A Hibernate bi-directional One-to-Many relationship does not map easily to JSON. If default (Jackson) mapping is used there is an infinite recursion issue as the parent contains the children each of which contains a reference to the parent.…
BarrySW19
  • 179
  • 1
  • 1
  • 6
7
votes
4 answers

Programmatically extending Hibernate table/entity definitions in Spring, how?

I would like to know if there is a way —maybe with AOP— to extend table/entity definitions so that I can add functionality across the board that requires persistence. Let me explain what I want to do with a concrete example. Let's suppose we have a…
dukeofgaming
  • 13,943
  • 6
  • 50
  • 77
7
votes
1 answer

Why were annotations introduced in Spring and Hibernate?

I would like to know why were annotations introduced in Spring and Hibernate? For earlier versions of both the frameworks book authors were saying that if we keep configuration in xml files then it will be easier to maintain (due to decoupling) and…
7
votes
3 answers

How significant are Spring and Hibernate in software development?

I am a software professional with about 1.6 years of experience in Java. Due to personal reasons, I had to quit my job, and now after 5 to 6 months, I am about start my career again. I am planning to attempt to take the SCJP exam, but some of my…
mercurixp
  • 87
  • 1
  • 1
  • 2
6
votes
1 answer

Is this database design good? What JPA Entities should I create for this design?

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below. Is this design good ? Any suggestions for improvement are more than welcome. I am also confused about what Entity…
Nils
  • 207
  • 1
  • 5
6
votes
4 answers

Performance related doubt in Java with Hibernate

Suppose in some ORM based project (say Hibernate) I am trying to fetch only few columns rather then the whole Object with may be more than 20 attributes. I am writing HQL like "select attr1, attr2 from Entity ". I know I am not taking advantage of…
Logicalj
  • 174
  • 11
1
2 3 4 5 6