Junior — Middle
What object-relational mapping tools are you familiar with and have used in practice?
sobes.tech AI
Answer from AI
Object-Relational Mapping (ORM) is a technology that allows working with a database through programming language objects, hiding SQL queries.
Among the ORM tools I have used in practice with Java:
- Hibernate — the most popular ORM framework, supports JPA, allows mapping classes to tables, managing sessions and transactions.
- Spring Data JPA — a wrapper over Hibernate, simplifying work with repositories and queries.
- MyBatis — although not a classic ORM, but a mapper, often used for flexible mapping of SQL queries to objects.
Example of using Hibernate:
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
// getters and setters
}
// In the service
User user = entityManager.find(User.class, 1L);
Thus, ORM allows working with data as objects without worrying about SQL details.