Announcement Announcement Module
Collapse
No announcement yet.
Spring Data JPA + Oracle + Paging issue? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data JPA + Oracle + Paging issue?

    I'm trying out using Spring Data JPA with Hibernate and Oracle 11g. I could have sworn I had this working before, but I haven't touched the code in a few weeks and just got back to it so I'm not positive

    In my repository interface I have a method like this:
    Code:
    public Page<Log> findByCreateByDttmAfter(Date createByDate, Pageable pageable);
    When I run the application I am getting a "ORA-00933: SQL command not properly ended" error. There are two sqls from Hibernate that is displaying in the logs. One is to get a count of how many rows will be returned and that seems to be ok.

    Code:
    select count(*) as col_0_0_ from LOG log0_ where log0_.CREATE_BY_DTTM>?
    The second one is what's causing the issue:
    Code:
    select <fields_removed_for_brevity>
    from LOG log0_ where log0_.CREATE_BY_DTTM>? order by log0_.CREATE_BY_DTTM desc limit ?
    If I remove the limit clause in an oracle client, the sql will work. I don't THINK oracle has a limit clause but uses a rownum < ? type of thing. Is Hibernate creating this sql or is this Spring Data? Is there something special I need to set for Oracle?

  • #2
    Nevermind. Found it.

    Code:
    <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    	<property name="generateDdl" value="true" />
    	<property name="showSql" value="true" />
    	<property name="database" value="ORACLE" />
    </bean>

    Comment

    Working...
    X