[Hibernate-JIRA] Created: (HHH-2509) Criteria.setMaxResults(int) broken with Oracle9Dialect, only works with a long in a HQL query
by Gabriel Goïc (JIRA)
Criteria.setMaxResults(int) broken with Oracle9Dialect, only works with a long in a HQL query
---------------------------------------------------------------------------------------------
Key: HHH-2509
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2509
Project: Hibernate3
Type: Bug
Components: query-criteria
Versions: 3.2.0.cr5
Environment: Windows XP, Oracle 9, Spring 2.0.3, Hibernate 3.2.0.cr5
Reporter: Gabriel Goïc
Willing to extract 50 random elements from my database, I wrote the following snippet of code:
Criteria crit = getSession().createCriteria(Woffre.class);
crit.setMaxResults(50);
crit.addOrder(Order.asc("sid"));
return crit.list();
As you can see, there's nothing particular here. But executing this code gives the following error:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2160)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2041)
at org.hibernate.loader.Loader.list(Loader.java:2036)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at fr.apec.proto.server.dao.impl.WOffreDAOImpl.loadFirst50WOffres(WOffreDAOImpl.java:55)
(...)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.driver.OracleStatement.checkBindsInAndOut(OracleStatement.java:1971)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2812)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
(...)
So, I decided to use HQL to work around this problem and copied/pasted the "where" clause displayed as a log when using the Criteria API :
getHibernateTemplate().find("from Woffre woffre where rownum <= ? order by woffre.sid asc", 50);
... which produces a java.lang.ClassCastException with java.lang.Integer whereas the following
getHibernateTemplate().find("from Woffre woffre where rownum <= ? order by woffre.sid asc", (long)50);
... just works fine
It seems that Criteria.setMaxResults(int) should take a long instead of an int, as the Criteria API seems not able to get the conversion done, which causes a crash; or maybe the underlying implementation should be able to work with an int...
PS: I first posted this problem on the hibernate users forum : http://forum.hibernate.org/viewtopic.php?t=972225
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months
[Hibernate-JIRA] Created: (EJB-280) java.lang.NoSuchMethodError: Hibernate EM 3.3.0 breaks Jboss Embedded EJB3 due to method signature change
by Allon Rauer (JIRA)
java.lang.NoSuchMethodError: Hibernate EM 3.3.0 breaks Jboss Embedded EJB3 due to method signature change
---------------------------------------------------------------------------------------------------------
Key: EJB-280
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-280
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Versions: 3.3.0.ga
Reporter: Allon Rauer
Jboss Embedded EJB3 relies static method in org.hibernate.ejb.packaging.PersistenceXmlLoader:
public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver throws Exception
however this method's signature has been changed to
public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver,
PersistenceUnitTransactionType defaultTransactionType) throws Exception
stacktrace:
Caused by: java.lang.NoSuchMethodError: org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(Ljava/net/URL;Ljava/util/Map;Lorg/xml/sax/EntityResolver;)Ljava/util/List;
at org.jboss.ejb3.Ejb3Deployment.initializePersistenceUnits(Ejb3Deployment.java:602)
at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:465)
at org.jboss.ejb3.embedded.EJB3StandaloneDeployer.create(EJB3StandaloneDeployer.java:437)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months
[Hibernate-JIRA] Moved: (HHH-2508) Missing sequence or table on Oracle
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2508?page=all ]
Emmanuel Bernard moved EJB-278 to HHH-2508:
-------------------------------------------
Component: (was: EntityManager)
core
Key: HHH-2508 (was: EJB-278)
Project: Hibernate3 (was: Hibernate Entity Manager)
> Missing sequence or table on Oracle
> -----------------------------------
>
> Key: HHH-2508
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2508
> Project: Hibernate3
> Type: Patch
> Components: core
> Environment: JBoss 4.0.5.GA, Using JBoss SEAM and Oracle 9i, EJB/JPA annotations
> Reporter: André Fernandes
>
>
> Here we use a user "project_web" to access a "dbproject" schema.
> The problem is, when Hibernate looks for the sequences, it looks in the user_sequences, but my user (project_web) don't have any sequences.
> The solving is: when getting the sequence names (org.hibernate.dialect.Oracle9Dialect .getQuerySequencesString) use that:
> select SEQUENCE_NAME from all_sequences where SEQUENCE_OWNER='DBPROJECT'
> i.e. use the schema to look in the all_sequences.
> Sorry for the bad english.
> package org.hibernate.dialect;
> public class Oracle9Dialect extends Dialect {
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences";
> }
> @GeneratedValue(generator="sqCoSeqProjeto", strategy=GenerationType.SEQUENCE)
> @SequenceGenerator(name="sqCoSeqProjeto", sequenceName="sq_coseqprojeto", allocationSize=5)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months
[Hibernate-JIRA] Moved: (HHH-2507) Support for CLOB not working for DB2 when table per concrete class is being used
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2507?page=all ]
Emmanuel Bernard moved EJB-276 to HHH-2507:
-------------------------------------------
Version: (was: 3.2.1)
3.2.2
Key: HHH-2507 (was: EJB-276)
Project: Hibernate3 (was: Hibernate Entity Manager)
> Support for CLOB not working for DB2 when table per concrete class is being used
> --------------------------------------------------------------------------------
>
> Key: HHH-2507
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2507
> Project: Hibernate3
> Type: Bug
> Versions: 3.2.2
> Reporter: breako
>
>
> Hi,
> This came up in the forums:
> http://forum.hibernate.org/viewtopic.php?p=2344008#2344008
> Sample code: Two Pojos
> @Entity
> public class Person {
> private int i;
> @Identity
> public int getI() {
> return i;
> }
> public void setI(int i){
> this.i = i;
> }
> }
> @Entity
> public class Employee extends Person{
> @Basic(fetch=FetchType.LAZY)
> @Lob
> public String getClobAttr() {
> return clobAttr;
> }
>
> public void setClobAttr(String clobAttr) {
> this.clobAttr = clobAttr;
> }
> }
> Simple test:
> public static void main (String args[]) {
> Query queryImpl = em.createQuery(" from Person");
> List list = queryImpl.getResultList();
> }
> This will generate SQL
> select person0_.clobAttr as clobAttr1 from (select nullif(0,0) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
> which chucks the exception:
> DB2 SQL error: SQLCODE: -415, SQLSTATE: 42825, SQLERRMC: null
> I think the SQL hibernate should generate should be:
> select person0_.clobAttr as clobAttr1 from (select cast(null as CLOB) as clobAttr from TPerson union all select clobAttr from TEmployee) person0_
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months
[Hibernate-JIRA] Created: (HHH-2471) create an enhanced set up id generators
by Steve Ebersole (JIRA)
create an enhanced set up id generators
---------------------------------------
Key: HHH-2471
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2471
Project: Hibernate3
Type: New Feature
Components: core
Reporter: Steve Ebersole
Assigned to: Steve Ebersole
Fix For: 3.2.3
Specifically, the build the following two capabilities:
1) a sequence "style" generator targetting cross db portability in a better fashion that native. specifically, use sequences if dialect supports them; otherwise fall back to a table-based implementation *with the same characteristics*.
2) ability to easily apply "optimizations" without needing to create a whole new generator. by optimizations i mean wrapping in a hilo or "pooled" algorithm.
This will result in two new generators:
1) SequenceStyleGenerator
2) SegmentedTableGenerator (better names welcome)
Specifically, SequenceStyleGenerator by itself fulfills requirement #1. It does also accept pluggable optimizers.
SegmentedTableGenerator is to be a rewrite of the current MultiTableHiLoGenerator which performs the same basic function as MultiTableHiLoGenerator in terms of table layout in order to store multiple (or segmented) sequences. However, it will also take advantage of the pluggable optimizers.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 7 months