Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select count(*) as y0_ from SUMMARY_VIEW this_ where this_.ser_id like :1 and this_.TYPE=:2 and this_.TIME_LOCAL>=:3 and this_.TIME_LOCAL<=:4
- select count(*) as y0_ from SUMMARY_VIEW this_ where this_.ser_id like :ser_id and this_.TYPE=:type and this_.TIME_LOCAL>=:startdate and this_.TIME_LOCAL<=:enddate
- select sql_text, v.sql_id, name, value_string, datatype_string from v$sql_bind_capture vbc join v$sql v using (hash_value) where v.sql_id in (?)
- import java.io.Serializable;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Timestamp;
- import java.sql.Types;
- import java.util.Objects;
- import oracle.sql.DATE;
- import org.hibernate.engine.spi.SessionImplementor;
- import org.hibernate.usertype.UserType;
- public class OracleDate implements UserType {
- @Override
- public int[] sqlTypes() {
- return new int[] { Types.TIMESTAMP };
- }
- @Override
- public Class<?> returnedClass() {
- return Timestamp.class;
- }
- @Override
- public Object nullSafeGet(
- ResultSet rs,
- String[] names,
- SessionImplementor session,
- Object owner
- )
- throws SQLException {
- return rs.getTimestamp(names[0]);
- }
- @Override
- public void nullSafeSet(
- PreparedStatement st,
- Object value,
- int index,
- SessionImplementor session
- )
- throws SQLException {
- // The magic is here: oracle.sql.DATE!
- st.setObject(index, new DATE(value));
- }
- // The other method implementations are omitted
- }
- @Entity
- @TypeDefs(
- value = @TypeDef(
- name = "oracle_date",
- typeClass = OracleDate.class
- )
- )
- public class Rental {
- @Id
- @Column(name = "rental_id")
- public Long rentalId;
- @Column(name = "rental_date")
- @Type(type = "oracle_date")
- public Timestamp rentalDate;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement