r/hibernate • • Jun 11 '15

Hibernate cheatsheet

Thumbnail ndpsoftware.com
0 Upvotes

r/hibernate • • Mar 30 '15

Session.get() & Session.load() with example code

Thumbnail aurorasolutions.io
0 Upvotes

r/hibernate • • Dec 31 '22

Any annotation for the <hibernate-mapping> available ???

0 Upvotes

Hi

Can any body suggest any annotation available for "<hibernate-mapping>"

An annotation may save Entity class missing from HibernateConfig.xml"

ex : - <mapping class="com.hiber.entity.person.Personal" /> replaced by an annotation at entity class


r/hibernate • • Apr 04 '22

Hibernate 6.0 Final - In Relation To

Thumbnail
in.relation.to
1 Upvotes

r/hibernate • • Mar 28 '22

MappingException: Composite-id class must implement Serializable

1 Upvotes

I'm starting to use Hibernate for the first time and got this error. I see that I need to add Serialiable somehow, but I'm not finding a definitive explanation. I'd really appreciate a direct explanation.

For reference, my code goes as follows:

@Entity
@Table(name="Role")
public class Role{

    @Id
    @Column(name="ID")
    private String id;

    @Id
    @Column(name="ROLE_ID")
    private String role_id;
....

Thanks in advance!


r/hibernate • • Jun 20 '13

How to create One to Many and Many to One mapping between two database tables using hibernate

Thumbnail
mrbool.com
3 Upvotes

r/hibernate • • Mar 05 '18

Create a separate EAR for just the DAOs with Hibernate Criteria Queries and regular SQL Queries?

1 Upvotes

Say we have a monolithic architecture with several EARs having their own DAOs for a few tables with shared fields. If we make change to one EAR, it requires us to make changes in the other EARs as well. It is a tightly coupled environment. To avoid this can we separate the DAOs into a separate EAR? Shall we use factory DAO here? How do we eliminate this dependency?


r/hibernate • • Jun 11 '13

How to create Database Table using Hibernate

Thumbnail
mrbool.com
3 Upvotes

r/hibernate • • Jul 31 '16

higher skillset

1 Upvotes

hi, i have been using hibernate for few years but i stopped enhance my skills. Is there any great helper library that work with hibernate will make our life better (higher performance, easy to code)? thanks


r/hibernate • • Jan 30 '17

How to implement a soft delete with Hibernate

Thumbnail
thoughts-on-java.org
4 Upvotes

r/hibernate • • Sep 19 '13

Working with Filters in Hibernate

Thumbnail
mrbool.com
1 Upvotes

r/hibernate • • Oct 15 '13

Mixing Annotation Based and XML Mapping in Hibernate

Thumbnail
technology-ebay.de
2 Upvotes

r/hibernate • • Oct 22 '13

Using Google Web Toolkit with Hibernate

Thumbnail
mrbool.com
1 Upvotes

r/hibernate • • Aug 16 '18

I want to learn Hibernate and JPA in depth. What resources should I look into.

1 Upvotes

I started following Java Persistence with Hibernate, but it turned out to be second edition, so along the way I found many of the tools are no longer supported or used. So I am looking into something which prepares me for industry today.


r/hibernate • • Feb 25 '19

Two different databases with one field different.

1 Upvotes

I'm working on getting a particular system working where there are two identical databases, except one database has tables with an extra field. I want to use AbstractRoutingDataSource to determine, at runtime, which datasource to use.

I'd like to use the same hibernate mappings, if possible, but make one field "@Transient" for the database/datasource that has tables missing the one field.

Is there some way to accomplish this?


r/hibernate • • Nov 25 '18

Hibernate 5 Dialect - Learn to use different types of dialects in Hibernate 5

Thumbnail
roseindia.net
1 Upvotes

r/hibernate • • Aug 19 '21

Hibernate Interview Questions 2021 - InterviewMocks

Thumbnail
interviewmocks.com
1 Upvotes

r/hibernate • • Aug 20 '21

Hibernate question

1 Upvotes

Hey. I have a hibernate problem that's driving me nuts. Nobody is responding on stackoverflow.com. Where should seek help?


r/hibernate • • Dec 02 '20

Hibernate: Does it eventually use SQL somewhere that I can see?

3 Upvotes

I'm debugging a massive application that uses Hibernate, which I am not familiar with.

I'm trying to find out why the application ( many confusing layers above Hibernate ) is sending out error messages about there being no data, when I can see the data in the database ( Postgres ).

Does Hibernate eventually somewhere deep down make SQL queries that I can see? Some other commands I can see such that I can learn what it is asking for so I can tell why it isn't finding it?


r/hibernate • • Jun 06 '18

How to optimize an HQL query that join two big tables

Thumbnail
stackoverflow.com
1 Upvotes

r/hibernate • • Aug 23 '19

Hibernate Join with Json list of Identifiers

1 Upvotes

I have table foo, identified by fooId, and table bar which contains a json list of fooIds.

Example of foo:

foo1,"Some random description"

Example of bar:

bar1,["foo1", "foo2"]

I am using Hibernate/JPA and want to perform the join such that when I get bar1, I get the foo object as well.

I have a converter class SQLJsonListConverter which deserializes the JSON blob and correctly gives me the ids. However, I'm unable to loop that in with a @ManyToMany or @JoinTable annotation. I've also tried @JsonManagedReference. My question is similar to: How to include join column in json result with JPA+Hibernate but slightly different as I have a list of identities.

Any help would be appreciated.


r/hibernate • • May 26 '20

How to fetch just the entity from Many to many relationship

1 Upvotes

Hi, I am developing a rest api and I have a many-to-many relationship between Author and Book. When I try to get Author by id (session.get(Author.class, 1) hibernate complains and says "failed to lazily initialize a collection" but I don't want to show all Books of an Author, I want to just show the details of the Author. How can I accomplish this?


r/hibernate • • Jul 12 '23

Re-Posting @JoinColumn in JPA creating extra columns for all mapping

1 Upvotes

Hi

Spec : Java 17 , Mariadb 10.x, Windows , Eclipse ( Latest )

a)State Entity to b )City Entity with ( Each State has multiple Cities ) OneToMany Mapping

I have mapped 2 nos of entities which has a 'OneToMany' Mapping

Problem when executed at runtime tends the JoinColumn in the JPA is creating Extra columns in DB.

Note: - DB belongs to client and has specific instruction not to use DDL on the DB.

Question

1) Does JPA needs Primary/Foreign Key for Joining a Simple Query ?
2) What needs to be done in order to PREVENT the Extra columns being created at run time ?

I am sure other types of Mappings also have same problems..

Please Advise ....


r/hibernate • • Aug 26 '23

Which class do I use to generate UUID using GenericGenerator?

1 Upvotes

I'm following along with a Spring 6 course and the instructor used this line when generating a UUID in an Entity class.

@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")

IntelliJ is throwing a warning on strategy saying that it was deprecated. I went through the docs to find the new package I should be using, and I found this...

@GenericGenerator(name = "UUID", type = org.hibernate.id.uuid.UuidGenerator.class)

the problem is now the spring application won't start, saying that I should use the deprecated package instead. Or in some cases it can't find the bean that it needs to use the UUID package.

Parameter 0 of constructor in org.hibernate.id.uuid.UuidGenerator required a bean of type 'org.hibernate.annotations.UuidGenerator' that could not be found.

I'm not sure how to fix this, or entirely sure what this error message actually means. Should I just use the deprecated strategy property? Or am I missing something with the new way it's done?


r/hibernate • • Aug 07 '23

How to download hibernate ORM

1 Upvotes

Hello, I can't seem to find the Download ZIP archieve button in the hibernate website (it does appear in tutorials, years ago). I can't seem to find any button that will download the jar files for the hibernate orm.

Link: 6.2 series - Hibernate ORM