[Hibernate-JIRA] Created: (HV-146) ValidatorTypeHelper.resolveTypes ignores return value of recursive call
by Eddy Verbruggen (JIRA)
ValidatorTypeHelper.resolveTypes ignores return value of recursive call
-----------------------------------------------------------------------
Key: HV-146
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-146
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.0.0.Alpha3
Reporter: Eddy Verbruggen
My Validator classes extend a common superclass, which in turn implements the ConstraintValidator interface. This version of Hibernate Validator can't cope with that class structure due to a little bug in ValidatorTypeHelper.resolveTypes.
The last bit of that method calls itself recursively, but ignores returnvalues, so the code always falls through to "return null".
else {
resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
for ( Type genericInterface : rawType.getGenericInterfaces() ) {
resolveTypes( resolvedTypes, genericInterface );
}
}
}
//else we don't care I think
return null;
Can it be changed to something like this please:
else {
Type returnedType = resolveTypes( resolvedTypes, rawType.getGenericSuperclass() );
if ( returnedType != null ) {
return returnedType;
}
for ( Type genericInterface : rawType.getGenericInterfaces() ) {
returnedType = resolveTypes( resolvedTypes, genericInterface );
if ( returnedType != null ) {
return returnedType;
}
}
}
}
//else we don't care I think
return null;
The stacktrace is:
java.lang.NullPointerException
at org.hibernate.validation.util.ValidatorTypeHelper.extractType(ValidatorTypeHelper.java:68)
at org.hibernate.validation.util.ValidatorTypeHelper.getValidatorsTypes(ValidatorTypeHelper.java:57)
at org.hibernate.validation.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:163)
at org.hibernate.validation.engine.ConstraintTree.getInitalizedValidator(ConstraintTree.java:144)
at org.hibernate.validation.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113)
at org.hibernate.validation.engine.MetaConstraint.validateConstraint(MetaConstraint.java:126)
at org.hibernate.validation.engine.ValidatorImpl.validatePropertyForGroup(ValidatorImpl.java:419)
at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:373)
at org.hibernate.validation.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:132)
--
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
16 years, 11 months
[Hibernate-JIRA] Created: (HHH-3035) could not read column value from result set: MEDFAC1_14_0_; Invalid column name SQL Error: 17006, SQLState: null
by sanjeev singh (JIRA)
could not read column value from result set: MEDFAC1_14_0_; Invalid column name SQL Error: 17006, SQLState: null
----------------------------------------------------------------------------------------------------------------
Key: HHH-3035
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3035
Project: Hibernate3
Issue Type: Bug
Components: core, query-criteria, query-hql, query-sql
Affects Versions: 3.2.2
Environment: JDK5 , Hibernate Junit Test case,WIndows XP
Reporter: sanjeev singh
The following is my section of hibernate mapping file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="gov.njdhss.hippocrates.ems.valueobjects">
<class name="HeprEmsMedfacFacilityVO" table="HEPR_MEDFAC">
<id name="medfacId" column="MEDFAC_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">HEPR_MEDFAC_SEQ</param>
</generator>
</id>
<property name="medfacName" type="java.lang.String"
column="MEDFAC_NAME" update="true" insert="true">
</property>
<property name="facCode" type="java.lang.String"
column="FAC_CODE" update="true" insert="true">
</property>
</class>
<sql-query name="allfacility">
<return alias="facilities" class="HeprEmsMedfacFacilityVO" >
<return-property name="medfacName" column="MEDFAC_NAME"/>
</return>
<![CDATA[
select facilities.MEDFAC_NAME AS medfacName
from HEPR_MEDFAC facilities
]]>
</sql-query>
</hibernate-mapping>
I am trying to execute the query using the following client code:
public List getAllFacility() {
List listAllFacilities = null;
listAllFacilities = getHibernateTemplate().findByNamedQuery(
"allfacility");
return listAllFacilities;
}
The following is the error:
Hibernate:
select
facilities.MEDFAC_NAME AS medfacName
from
HEPR_MEDFAC facilities
- could not read column value from result set: MEDFAC1_14_0_; Invalid column name
- SQL Error: 17006, SQLState: null
- Invalid column name
- Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
- SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
Any idea if it is a bug or there is any error in my code.
--
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
16 years, 11 months
[Hibernate-JIRA] Created: (ANN-554) NPE with @Id on @OneToOne
by Loïc Minier (JIRA)
NPE with @Id on @OneToOne
-------------------------
Key: ANN-554
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-554
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Environment: Hibernate 3.2.2 GA, Hibernate Annotations 3.2.1, J2SE 1.6.0-b105 on Debian GNU/Linux sid, PostgreSQL 7.4
Reporter: Loïc Minier
Priority: Minor
Hi,
(Note: I originally reported this on the forum, but the lack of response suggests this might be a bug in Hibernate Annotations or Hibernate; the forum topic is at: http://forum.hibernate.org/viewtopic.php?t=970823)
I hope it's not a misuse of Hibernate, but I'm trying to use @Id on @OneToOne, and this causes the following NPE when running hbm2ddl:
java.lang.NullPointerException
at org.hibernate.util.StringHelper.qualify(StringHelper.java:264)
at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:196)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:287)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
What I'm trying to do at the application level is:
Foo class and table
long foo_id, primary key
FooData fooData, nulllable=true
FooData class and table
foo_id references Foo(foo_id), nullable=false
This is expressed in Java as:
@Entity
@Table(name = "foo")
public class Foo {
@Id @GeneratedValue
@Column(name = "foo_id")
Long id;
@OneToOne(mappedBy = "foo", cascade = CascadeType.ALL)
FooData fooData;
...
@Entity
@Table(name = "foo_data")
public class FooData {
@Id
@OneToOne
@JoinColumn(name = "foo_id", nullable = false)
Foo foo;
This causes a NPE here.
If I use a real Id on FooData, e.g.:
@Id
@Column(name = "foo_data_id")
Long id;
it works, and I end up with:
- foo_id in table foo as a primary key
- foo_data_id in table foo_data as a primary key
- foo_id in table foo_data not null
- foo_id in table foo_data references foo_id in table foo
I don't want a foo_data_id, I don't need it, hence the lack of it which leads to the NPE.
Bye,
--
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
16 years, 11 months
[Hibernate-JIRA] Created: (HBX-1032) HibernateConsoleRuntimeException: "Could not load JPA Configuration" for JavaSE JPA project
by Donatas Ciuksys (JIRA)
HibernateConsoleRuntimeException: "Could not load JPA Configuration" for JavaSE JPA project
-------------------------------------------------------------------------------------------
Key: HBX-1032
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1032
Project: Hibernate Tools
Issue Type: Bug
Affects Versions: 3.2.0.GA
Environment: Eclipse 3.3.1.1, HibernateTools 3.2.0 GA, JDK 1.6.0_03
Reporter: Donatas Ciuksys
Priority: Blocker
I have Java SE (not EE) project in Eclipse with standard structure like:
/src
/META-INF/persistence.xml
/bin
...
I try to create new Hibernate Configuration in "Hibernate Configurations" pannel. I choose project, select JPA (jdk 1.5+) option, fill in persistence unit "InventorizacijaPU", check whether Classpath tab is OK (it contains my project). Press OK. Trying to expand configuration created, I get this exception:
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:142)
at org.hibernate.console.ConsoleConfiguration.buildConfiguration(ConsoleConfiguration.java:496)
at org.hibernate.console.ConsoleConfiguration.access$0(ConsoleConfiguration.java:484)
at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:203)
at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
at org.hibernate.console.ConsoleConfiguration.buildWith(ConsoleConfiguration.java:185)
at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:106)
at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleConfigurationWorkbenchAdapter.java:38)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:97)
at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:103)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:196)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'InventorizacijaPU'.
at org.hibernate.console.ConsoleConfiguration.buildJPAConfiguration(ConsoleConfiguration.java:134)
... 11 more
This is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="InventorizacijaPU"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>lt.mitsoft.inventorizacija.domain.BuvimoVieta</class>
<class>lt.mitsoft.inventorizacija.domain.Inventorizacija</class>
<class>lt.mitsoft.inventorizacija.domain.Irasas</class>
<class>lt.mitsoft.inventorizacija.domain.IrasuBlokas</class>
<class>lt.mitsoft.inventorizacija.domain.Preke</class>
<class>lt.mitsoft.inventorizacija.domain.Skanuotojas</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.DerbyDialect" />
<!-- <property name="hibernate.connection.url"
value="jdbc:derby:InventorizacijaDB" /> -->
<property name="hibernate.connection.url"
value="jdbc:derby://localhost:1527/InventorizacijaDB" />
<!-- <property name="hibernate.connection.driver_class"
value="org.apache.derby.jdbc.EmbeddedDriver"/> -->
<property name="hibernate.connection.driver_class"
value="org.apache.derby.jdbc.ClientDriver" />
<property name="hibernate.connection.username"
value="admin" />
<property name="hibernate.connection.password"
value="admin" />
<property name="hibernate.cache.provider_class"
value="org.hibernate.cache.NoCacheProvider" />
<!-- <property name="hibernate.show_sql" value="true" /> -->
</properties>
</persistence-unit>
</persistence>
--
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
16 years, 11 months
[Hibernate-JIRA] Commented: (HHH-1657) hql update generate wrong sql with joined subclass hierarcy
by Carmelo Piccione (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
Carmelo Piccione commented on HHH-1657:
---------------------------------------
Yet another occurence of same issue. I wish the hibernate devs would at least respond to this thread.
delete EquityOptionEntity eoe where eoe.maturity < getDate() and eoe not in (select sle.security from StrategyLegEntity sle)
4:39:46,138 DEBUG [main] (SQLStatementLogger.java:111) - insert into #EQUITY_OPTIONS select equityopti0_.id as id from EQUITY_OPTIONS equityopti0_ inner join DERIVATIVES equityopti0_1_ on equityopti0_.id=equityopti0_1_.id inner join INSTRUMENTS equityopti0_2_ on equityopti0_.id=equityopti0_2_.id where maturity<getdate() and (id not in (select strategyle1_.security_id from STRATEGY_LEGS strategyle1_))
14:39:46,154 ERROR [main] (JDBCExceptionReporter.java:101) - Ambiguous column name 'id'.
14:39:46,154 ERROR [main] (UnusedExpiredInstrumentPruner.java:90) - persistence error when trying to delete equity options
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert/select ids for bulk delete
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:60)
at com.optifreeze.Xbook.SecurityMasterAdmin.UnusedExpiredInstrumentPruner.pruneEquityOptions(UnusedExpiredInstrumentPruner.java:76)
at com.optifreeze.Xbook.SecurityMasterAdmin.UnusedExpiredInstrumentPruner.main(UnusedExpiredInstrumentPruner.java:137)
Caused by: org.hibernate.exception.GenericJDBCException: could not insert/select ids for bulk delete
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.hql.ast.exec.MultiTableDeleteExecutor.execute(MultiTableDeleteExecutor.java:125)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:419)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:283)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1168)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:51)
... 2 more
Caused by: java.sql.SQLException: Ambiguous column name 'id'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:631)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:584)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:546)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:505)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)
at org.hibernate.hql.ast.exec.MultiTableDeleteExecutor.execute(MultiTableDeleteExecutor.java:116)
... 7 more
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Assignee: Gail Badner
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
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
16 years, 11 months
[Hibernate-JIRA] Commented: (HHH-1088) IdentifierProjection does not work with composite keys
by Michael Grünewald (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1088?page=c... ]
Michael Grünewald commented on HHH-1088:
----------------------------------------
Can you assume the order of key attributes returned?
Otherwise it really makes no sense for compound keys, unless it would be able to return the @IdClass.
Maybe that would be a nice extension of this feature.
> IdentifierProjection does not work with composite keys
> ------------------------------------------------------
>
> Key: HHH-1088
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1088
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.1 rc2
> Reporter: Max Muermann
> Attachments: CompositeIdProjection.java, CriteriaLoader.java
>
>
> When working with Criteria queries, the IdentifierProjection breaks if the entity has a composite key.
> In IdentifierProjection.java:
> public String toSqlString(Criteria criteria, int position, CriteriaQuery criteriaQuery)
> throws HibernateException {
> StringBuffer buf = new StringBuffer();
> String[] cols = criteriaQuery.getIdentifierColumns(criteria);
> for ( int i=0; i<cols.length; i++ ) {
> buf.append( cols[i] )
> .append(" as y")
> .append(position + i)
> .append('_');
> }
> return buf.toString();
> }
> This method does not add commas as separators between the column names. Easily fixed by adding
> if (i<col.length-1)
> buf.append(",");
> as the last statement inside the loop.
> However, this leads to another problem:
> the type returned by IdentifierProjection.geType is the (single) type of the composite id component. The query will however return the property values of the id component without a mapping step.
--
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
16 years, 11 months