[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
15 years, 8 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
15 years, 8 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
15 years, 8 months
[Hibernate-JIRA] Created: (HHH-3229) Make cascade rules more transparent/explicit/deterministic
by Chris Bredesen (JIRA)
Make cascade rules more transparent/explicit/deterministic
----------------------------------------------------------
Key: HHH-3229
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3229
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.6, 3.2.5, 3.2.4.sp1
Reporter: Chris Bredesen
Cascade rules are prone to different behavior based on the order in which properties appear in mapping XML. It is possible that an unexpected TransientObjectException may arise from certain operations when an object graph with circular references is merged (and possibly persisted/updated, etc).
For example, if a transient instance is reachable through more than once path from a root entity, it is not clear whether operations will be cascaded to it. The order in which the properties are mapped plays a part in determining cascade paths, but the rules are not documented.
Possible resolutions include:
1. Documenting the rules so that a programmer can make educated decisions about mapping.
2. Enhancing the algorithm such that order no longer matters and the rules are deterministic.
3. ???
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (HBX-779) jdbc reengineer sql-type problem with oracle 9i
by jacky hua (JIRA)
jdbc reengineer sql-type problem with oracle 9i
-----------------------------------------------
Key: HBX-779
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-779
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta8
Environment: windowsxp sp2, jdk 1.4.2, eclipse 3.1.2
Reporter: jacky hua
I used the ant task hibernate-tools provided like the below to generate hbms xml
<target name="default" description="generate hbm">
<delete dir="./generate"/>
<mkdir dir="./generate"/>
<hibernatetool destdir="./generate">
<jdbcconfiguration
configurationfile="./metadata/hibernate.cfg.xml"
revengfile="./metadata/hibernate.reveng.xml"
packagename="net.ema.examples.sa"
detectmanytomany="true"
detectoptimisticlock="true">
</jdbcconfiguration>
<hbm2hbmxml destdir="./generate" />
</hibernatetool>
</target>
the ./metadata/hibernate.cfg.xml like the below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
<hibernate-reverse-engineering>
<schema-selection match-catalog="TITAN" match-schema="TITAN" />
<type-mapping>
<!-- jdbc-type is name fom java.sql.Types -->
<!-- length, scale and precision can be used to specify the mapping precisly -->
<sql-type jdbc-type="NUMERIC" precision="1"
hibernate-type="boolean" />
<!-- the type-mappings are ordered. This mapping will be consulted last,
thus overriden by the previous one if precision=1 for the column -->
<sql-type jdbc-type="NUMERIC" precision="19" hibernate-type="long" />
<sql-type jdbc-type="TIMESTAMP" hibernate-type="java.util.Date" />
</type-mapping>
<!-- BIN$ is recycle bin tables in Oracle -->
<table-filter match-name="BIN$.*" exclude="true" />
</hibernate-reverse-engineering>
But the <sql-type jdbc-type="NUMERIC" precision="19" hibernate-type="long" /> didn't work, also generate big_decimal type not long type, otherwise the others two sql-type rules worked. the not affected column:USER_ID was pk of my table. the generated hbm file is like the below:
<class name="net.ema.examples.sa.UserModel" table="T_SA_USER" schema="TITAN">
<id name="userId" type="big_decimal">
<column name="USER_ID" scale="0" />
<generator class="assigned" />
</id>
<property name="logonName" type="string">
<column name="LOGON_NAME" length="60" />
</property>
<property name="password" type="string">
<column name="PASSWORD" length="80" />
</property>
<property name="isOrgAdmin" type="java.lang.Boolean">
<column name="IS_ORG_ADMIN" precision="1" scale="0" />
</property>
<property name="remark" type="string">
<column name="REMARK" length="400" />
</property>
<property name="createDate" type="java.util.Date">
<column name="CREATE_DATE" length="11" />
</property>
<property name="status" type="string">
<column name="STATUS" length="2" />
</property>
</class>
--
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
15 years, 8 months
[Hibernate-JIRA] Created: (EJB-337) Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
by valery gorbunov (JIRA)
Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
-------------------------------------------------------------------------------------
Key: EJB-337
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-337
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: OS Linux
Hibernate 3.2.5ga
HiberanteEM -3.3.1ga
Reporter: valery gorbunov
Priority: Critical
Entity scanning failed when path contains spaces
Stack trace is:
java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:74)
at org.jboss.util.file.FileProtocolArchiveBrowserFactory.create(FileProtocolArchiveBrowserFactory.java:48)
at org.jboss.util.file.FileProtocolArchiveBrowserFactoryTest.testCreate(FileProtocolArchiveBrowserFactoryTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:133)
at java.util.jar.JarFile.<init>(JarFile.java:97)
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:69)
... 24 more
Problem in FileProtocolArchiveBrowserFactory class
see test:
package org.jboss.util.file;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import junit.framework.Assert;
import org.junit.Test;
/**
*
* @author Valery Gorbunov <a href=mailto:vgorbunov@comodo.com.ua>vgorbunov(a)comodo.com.ua</a>
*/
public class FileProtocolArchiveBrowserFactoryTest {
@Test
public void testCreate() throws MalformedURLException, URISyntaxException {
URI uri = new URI("file:/tmp/Path%20with%20space");
File f = new File(uri);
if (!f.exists()) {
Assert.assertTrue(f.mkdir());
}
FileProtocolArchiveBrowserFactory factory = new FileProtocolArchiveBrowserFactory();
Object ab = factory.create(f.toURI().toURL(), null);
assertNotNull(ab);
assertTrue(ab instanceof DirectoryArchiveBrowser);
}
}
--
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
15 years, 9 months
[Hibernate-JIRA] Created: (HHH-2782) Component getType caches the type value
by Kiss Zoltán (JIRA)
Component getType caches the type value
---------------------------------------
Key: HHH-2782
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: all
Reporter: Kiss Zoltán
Component class caches the value of the type attribute:
public Type getType() throws MappingException {
// added this caching as I noticed that getType() is being called multiple times...
if ( type == null ) {
type = buildType();
}
return type;
}
This forbids the use of 'dynamic attributes'.
For eg. if you try to add new properties to an existing dynamic-component with the addProperty method, then the rebuild of the session factory will failed, because the Component property will be invalid during the validation (in the Component there will be a different column span value, then in the cached ComponentType).
There should be a method like this in the Component class:
public void rebuildType() {
type = buildType();
}
With the help of this the type could be rebuild if it is necessary.
--
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
15 years, 9 months