[Hibernate-JIRA] Commented: (HHH-1936) IdentityGenerator doesn't support BigInteger as a valid identity type.
by Dan (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936?page=c... ]
Dan commented on HHH-1936:
--------------------------
Leave the field a Long and use the @Type hibernate annotation like this:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Type(type = "com.foo.util.SybaseIdentityType")
@Column(name = "iIdCon")
private Long id;
Here is the src for com.foo.util.SybaseIdentityType:
package com.foo.util;
import java.math.*;
import java.sql.*;
import org.hibernate.HibernateException;
import org.hibernate.type.LongType;
public class SybaseIdentityType extends LongType {
private static final long serialVersionUID = 1L;
public void set(PreparedStatement st, Object value, int index)
throws HibernateException, SQLException {
st.setBigDecimal(index, new BigDecimal(BigInteger
.valueOf(((Long) value).longValue())));
}
public int sqlType() {
return Types.NUMERIC;
}
}
> IdentityGenerator doesn't support BigInteger as a valid identity type.
> ----------------------------------------------------------------------
>
> Key: HHH-1936
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, Sybase 12.05, Window/ Unix
> Reporter: Leonid Shtivelman
>
> Identity generator strategy doesn't support BigInteger as a valid id type. This causes problem with Sybase which requires identity column to be numeric. It would seem an obvious way to get around this problem is to set column mapping to long in hibernate xml and the actual java object. This will solve obvious problem of creating identity, but will cause performance problem on selection. In order for Sybase to use index for parameter query the variable type of the parameter and column index type has to be the same. If ones maps column type to Long, Hibernate will use JDBC method setLong(long) to set value in the prepared statement. This will cause mismatch between parameter type and column index type, and Sybase will not use index to locate index. As you can see this is a big problem for anyone that is using identity columns Sybase and Hibernate
--
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, 1 month
[Hibernate-JIRA] Created: (HBX-1094) IllegalArgumentException: To cannot be null in DocFileManager.getRef
by Gérald Quintana (JIRA)
IllegalArgumentException: To cannot be null in DocFileManager.getRef
--------------------------------------------------------------------
Key: HBX-1094
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1094
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2doc
Affects Versions: 3.2.4 Beta1
Environment: Windows, Java 1.6.0_10, Oracle 10.2, Hibernate 3.2.6
Reporter: Gérald Quintana
Running Hbm2Doc on a bunch of JPA annotated Entities, I get and IllegalArgumentException: To cannot be null in DocFileManager.getRef (see stack trace below).
Some HTML files (\hbm2doc\tables\default\MY_TABLE.html) gets created before Hbm2Doc ends with this exception. There might be something in one entity code making the table.ftl FreeMarker template fail. Improving error log could help (which table has a problem?).
Stack trace
hbm2doc:
[hibernatetool] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration
[hibernatetool] 1. task: hbm2doc (Generates html schema documentation)
[hibernatetool] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
[hibernatetool] log4j:WARN Please initialize the log4j system properly.
[hibernatetool] An exception occurred while running exporter #2:hbm2doc (Generates html schema documentation)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.tool.hbm2x.ExporterException: Error while processing Unknown context with template doc/tables/table.ftl
[hibernatetool] freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile) threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@4310d0
[hibernatetool] java.lang.IllegalArgumentException: To cannot be null.
BUILD FAILED
org.hibernate.tool.hbm2x.ExporterException: Error while processing Unknown context with template doc/tables/table.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:261)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.DocExporter.processTemplate(DocExporter.java:614)
at org.hibernate.tool.hbm2x.DocExporter.generateTablesDetails(DocExporter.java:415)
at org.hibernate.tool.hbm2x.DocExporter.doStart(DocExporter.java:154)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
(...)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(org.hibernate.tool.hbm2x.doc.DocFile,org.hibernate.tool.hbm2x.doc.DocFile) threw an exception when invoked on org.hibernate.tool.hbm2x.doc.DocFileManager@4310d0
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
(...)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:255)
... 26 more
Caused by: java.lang.IllegalArgumentException: To cannot be null.
at org.hibernate.tool.hbm2x.doc.DocFileManager.getRef(DocFileManager.java:466)
(...)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 46 more
Ant:
<target name="hbm2doc">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="hibernate.class.path" />
<hibernatetool destdir="target/hibernate3/hbm2doc">
<classpath>(...)</classpath>
<annotationconfiguration configurationfile="hibernateConfig.xml"/>
<hbm2doc/>
</hibernatetool>
</target>
--
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, 1 month