Reputation: 3
i need to receive the size of data (in byte) from a postgres database. Postgres has this method called: octet_length what is exactly doing what i want. But i can't find a way to get the same from Hibernate. So is it possible to receive these information from Hibernate?
Upvotes: 0
Views: 277
Reputation: 771
It seems that Hibernate register the octet_length function into this dialect.
For example in PostgreSQL8Dialect.java we can see:
registerFunction( "octet_length", new StandardSQLFunction("octet_length", Hibernate.LONG) );
So you can use
Projections.SqlFunction
in your code
Upvotes: 1