title: Spring data Jpa findTop and findFirst generating error Incorrect syntax near '@P0'
body: <p>I am using spring data JPA 1.8.2 and trying to get top result. I am using the following method</p>
  
  <pre><code>LearningSession findTopBySourceAndExternalLmsSessionIdAndCourseCodeAndLearnerEnrollmentEnrollmentStatusOrderByIdAsc(String source, String externalLmsSessionId, String courseCode, String enrollmentStatus);
  </code></pre>
  
  <p>I tried also by removing OrderBy</p>
  
  <pre><code>LearningSession findTopBySourceAndExternalLmsSessionIdAndCourseCodeAndLearnerEnrollmentEnrollmentStatus(String source, String externalLmsSessionId, String courseCode, String enrollmentStatus);
  </code></pre>
  
  <p>In both cases hibernate is generating the following query. Just use <code>*</code> for every thing. For order by in the end <code>order by learningse0_.id asc</code></p>
  
  <pre><code>select TOP ?  learningse0_.*
  from LearningSession learningse0_ 
  left outer join LearnerEnrollment learnerenr1_ on learningse0_.ENROLLMENT_ID=learnerenr1_.id 
  where learningse0_.source=?
  and learningse0_.externalLmsSessionId=?
  and learningse0_.courseCode=?
  and learnerenr1_.enrollmentStatus=?
  </code></pre>
  
  <p>Query is right But I am getting the following exception</p>
  
  <pre><code>Hibernate: select TOP ?  learningse0_.id as id1_47_, learningse0_.brandName as brandNam2_47_, learningse0_.courseApprovalId as courseAp3_47_, learningse0_.courseCode as courseCo4_47_, learningse0_.endTime as endTime5_47_, learningse0_.externalLmsSessionId as external6_47_, learningse0_.externalLmsUrl as external7_47_, learningse0_.isCourseMessageDisplay as isCourse8_47_, learningse0_.LANGUAGE_ID as LANGUAG15_47_, learningse0_.LEARNER_ID as LEARNER16_47_, learningse0_.ENROLLMENT_ID as ENROLLM17_47_, learningse0_.learningSessionGuid as learning9_47_, learningse0_.lmsProvider as lmsProv10_47_, learningse0_.redirectUrl as redirec11_47_, learningse0_.source as source12_47_, learningse0_.startTime as startTi13_47_, learningse0_.uniqueUserGuid as uniqueU14_47_ from LearningSession learningse0_ left outer join LearnerEnrollment learnerenr1_ on learningse0_.ENROLLMENT_ID=learnerenr1_.id where learningse0_.source=? and learningse0_.externalLmsSessionId=? and learningse0_.courseCode=? and learnerenr1_.enrollmentStatus=? order by learningse0_.id asc
  13:53:47.686 [main] DEBUG org.hibernate.engine.jdbc.spi.SqlExceptionHelper - could not extract ResultSet [n/a]
  com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'          
  com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) ~[sqljdbc4-4.0.jar:?]
  </code></pre>
  
  <p>What I am doing wrong ? I tried <code>First</code>, <code>Top1</code>, <code>First1</code> but result is error. Please help.</p>
  
  <p>Thanks</p>