As I explained in my book, High-Performance Java Persistence
, it sounds like an index issue. Just paste the Execution Plan for both queries.
If the 2 queries use the same parameters, then it could be that the first one generates an Execution Plan plan on Oracle or SQL Server (which use an internal Execution Plan Cache) since the DB Engine can use the inlined parameter values when generating the plan. The one with prepared statements might use an old plan which was generated for a different set of values, which have a different cardinality.
If the 2 queries are not identical, then maybe the former one scans less data than the latter. Or maybe the former uses an index, while the latter runs a full-table scan.
If you don't paste the queries and their Execution Plans, it's hard to guess what's the actual root cause of your problem.