Contribute  :  Calendar  :  Advanced Search  :  Site Statistics  :  Directory  :  Files to download  :  Links for developers  :  Privacy policy  :  Web Resources  :  Polls  
    MacOSX Guru Site Information, tips and tricks, FAQ for Mac OS X developers    
 Welcome to MacOSX Guru Site
 Thursday, October 23 2014 @ 02:42 PM BST

JPA @Lob and PostgreSQL

   
Java DevelopmentLot of discussions with contradictory information on the Net about the problematic, here a quick resume of the "how to"


SQL                               Java

TEXT                             @Lob @Type(type = "org.hibernate.type.TextType")  String
oid                              @Lob java.sql.Blob 
bytea                            @Lob @Type(type = "org.hibernate.type.PrimitiveByteArrayBlobType") byte[]
and in a file named "hibernate.properties" available at the root of the classpath:

hibernate.jdbc.use_streams_for_binary=true
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
(and "hibernate.jdbc.use_streams_for_binary" should not be a "property" in persitence.xml as you may find on many sites: this doesn't work, look at the source code of the Hibernate properties loader if you don't believe us !)
 

What's Related

Story Options

JPA @Lob and PostgreSQL | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
 Copyright © 2014 MacOSX Guru Site
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.05 seconds