Today I will show you how to map BLOBs and CLOBs with JPA and Hibernate. You will learn how to map these database columns to a String or a byte[] and how to use the java.sql classes Blob and Clob. And at the end of this video, I will show you an easy and portable way to load your BLOBs and CLOBs lazily.
Especially the lazy-loading trick is a mapping that most developers are surprised about and that I have used with great success in various client projects.
But before we start, if this is your first time here, and you want to learn how to create your entity mappings with ease, build incredible efficient persistence layers with Hibernate and all types of other Java persistence related stuff, start now by subscribing and clicking the bell, so you don't miss anything.
Databases use the data types binary large object aka BLOB and character large object aka CLOB to store large objects, like images and very long texts. JPA and Hibernate provide two kinds of mappings for these types.
You can choose if you want to:
Materialize the LOB and map it to a byte[] or a String. This mapping is defined by the JPA specification and prioritizes ease of use over performance.
Or you can use JDBC’s LOB locators java.sql.Blob and java.sql.Clob. The LOB locators enable your JDBC driver to optimize for performance, e.g., by streaming the data. This mapping is Hibernate-specific.
If you like this video, please give me your thumbs up and share it with your friends and co-workers.
Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8
Join the free Member Library:
https://goo.gl/dtyIIC
Read the accompanying post: https://thoughts-on-java.org/mapping-...
Want to connect with me?
Blog: http://www.thoughts-on-java.org/
Twitter: / thjanssen123
Facebook: / thoughtsonjava
#JPA #Hibernate #blob #clob
Watch video Mapping BLOBs & CLOBs with JPA and Hibernate online without registration, duration hours minute second in high quality. This video was added by user Thorben Janssen 03 September 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 16,58 once and liked it 26 people.