Hibernate sequence on oracle, @GeneratedValue(strategy = GenerationType.AUTO)

These Annotations are no creating two sequences, only one. Is this correct/expected? That’s the expected behavior. When using @GeneratedValue(strategy = GenerationType.AUTO), the JPA provider will pick an appropriate strategy for the particular database. In the case of Oracle, this will be SEQUENCE and, since you did not specify anything, Hibernate will use a single global … Read more

Hibernate Criteria for Dates

Why do you use Restrictions.like(…)? You should use Restrictions.eq(…). Note you can also use .le, .lt, .ge, .gt on date objects as comparison operators. LIKE operator is not appropriate for this case since LIKE is useful when you want to match results according to partial content of a column. Please see http://www.sql-tutorial.net/SQL-LIKE.asp for the reference. … Read more

Does Oracle support full text search?

Oracle Text is the equivalent functionality. I’ve had good experiences with it. Assuming that you are maintaining the text index asynchronously, that tends to be the first source of problems, since it may be a bit between a change being made and the index getting updated, but that’s normally quite reasonable during normal operation.

ojdbc14.jar vs. ojdbc6.jar

The “14” and “6” in those driver names refer to the JVM they were written for. If you’re still using JDK 1.4 I’d say you have a serious problem and need to upgrade. JDK 1.4 is long past its useful support life. It didn’t even have generics! JDK 6 u21 is the current production standard … Read more

Oracle date difference to get number of years

I’d use months_between, possibly combined with floor: select floor(months_between(date ‘2012-10-10’, date ‘2011-10-10’) /12) from dual; select floor(months_between(date ‘2012-10-9’ , date ‘2011-10-10’) /12) from dual; floor makes sure you get down-rounded years. If you want the fractional parts, you obviously want to not use floor.

`show create table` equivalent in oracle sql

If you are asking about SQL*Plus commands (show create table table_name doesn’t appear to be a SQL statement), you can use the desc command SQL> desc emp Name Null? Type —————————————– ——– —————————- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) If you really want … Read more