[Hibernate-JIRA] Commented: (HHH-1012) Index not created by SchemaUpdate
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012?page=c... ]
Max Rydahl Andersen commented on HHH-1012:
------------------------------------------
can't recall - this is really really old code and the comment have basically been there forever.
> Index not created by SchemaUpdate
> ---------------------------------
>
> Key: HHH-1012
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012
> Project: Hibernate3
> Issue Type: Improvement
> Components: metamodel
> Affects Versions: 3.2.5
> Environment: Windows XP, MySQL/PostgreSQL
> Reporter: Xavier Farret
> Priority: Minor
> Attachments: Indexes.patch
>
>
> i'm using an hbm.xml as describe below and the 'hibernate.hbm2ddl.auto' is egal to update.
> <class table="featurestat" name=".....">
> <id name="id" type="long" column="idFeatureStat">
> <generator class="increment"/>
> </id>
> <properties name="fsUniqueValue" unique="true">
> ....
> </properties>
> <property name="frequency" .../>
> <property name="idFatherFeature" index="FeatStatDocExtSectFeat" not-null="true" type="long" column="..."/>
> ....
> </class>
> Indexes for pk or unique key are well created, but the index explicity named 'FeatStatDocExtSectFeat' is never created. If i put the property 'hibernate.hbm2ddl.auto' in the cfg.xml as 'create' the index is created. But in my case i have to set my property 'hibernate.hbm2ddl.auto' to update.
--
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
18 years, 2 months
[Hibernate-JIRA] Created: (HHH-2297) invalid id type error message doesn't report which entity
by Kelly Campbell (JIRA)
invalid id type error message doesn't report which entity
---------------------------------------------------------
Key: HHH-2297
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2297
Project: Hibernate3
Type: Patch
Components: metamodel
Versions: 3.2.0.ga
Reporter: Kelly Campbell
Priority: Minor
Attachments: hibernate-id-type.patch
The error message given here makes it very hard to determine what entity has the problem.
Simple patch is attached.
java.lang.UnsupportedOperationException: not a valid id type
at org.hibernate.type.CharacterType.getDefaultValue(CharacterType.java:20)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:48)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.EntityMetamodel.(EntityMetamodel.java:114)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:418)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:223)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1213)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
--
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
18 years, 2 months
[Hibernate-JIRA] Created: (HHH-2261) Setting hibernate.hbm2ddl.auto=validate causes problems on mySQL with numeric fields
by Christian Sprajc (JIRA)
Setting hibernate.hbm2ddl.auto=validate causes problems on mySQL with numeric fields
------------------------------------------------------------------------------------
Key: HHH-2261
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2261
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Reporter: Christian Sprajc
Hello,
We got a Problem when using the following setup:
1) JBoss 4.0.4A with Hibernate 3.2.0 / mySQl 4.x AND 5.x
2) Set hibernate.hbm2ddl.auto=validate
3) Using a usertype which uses the SQL type: Types.NUMERIC
When deploying our application I got the following error:
12:43:21,985 INFO [TableMetadata] columns: [paymenttype, amount, oid, remarks, currency, ae_date]
12:43:21,985 WARN [ServiceController] Problem starting service persistence.units:jar=com.riege.pogo_0.1.4.jar,unitName=PogoEntityManager
org.hibernate.HibernateException: Wrong column type: amount, expected: numeric(19,2)
at org.hibernate.mapping.Table.validateColumns(Table.java:251)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1002)
The Problem is:
1) When hibernate creates (e.g. hibernate.hbm2ddl.auto=update) through the columns in the mySQL database it creates it as "numeric(x,y)" field.
2) mySQL always converts "numeric(x,y)" to "decimal(x,y)". The metadata returns "decimal(x,y)"
3) When deploying with "hibernate.hbm2ddl.auto=validate" to error above is thrown. The problem is that hibernate expects a "numeric(x,y)" type but mysql returns a "decimal(x,y)"
A workaround I'm now using is a fixed mySQL dialect which correctly handles Types.DECIMAL / "decimal(x,y)":
public class FixedMySQLDialect extends org.hibernate.dialect.MySQLDialect {
public FixedMySQLDialect() {
super();
registerColumnType(Types.NUMERIC, "decimal(19, $l)");
registerColumnType(Types.DECIMAL, "decimal(19, $l)");
}
}
--
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
18 years, 2 months
[Hibernate-JIRA] Resolved: (HHH-1008) SchemaValidator mapping of double to SQL-Type DECIMAL with Precision and Scale
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1008?page=c... ]
Diego Pires Plentz resolved HHH-1008.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Duplicate
> SchemaValidator mapping of double to SQL-Type DECIMAL with Precision and Scale
> ------------------------------------------------------------------------------
>
> Key: HHH-1008
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1008
> Project: Hibernate3
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.1 beta 2
> Environment: DB2, Win2k
> Reporter: Phritz Grau
> Assignee: Diego Pires Plentz
> Priority: Minor
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> I am using the new SchemaValidator, it really is very useful. 1000x thanks.
> However we have one problem.
> Our tables contain a lot columns of SQL-Type DECIMAL with precision and scale.
> These are mapped to double or java.lang.Double and
> we specify the mapping like e.g.:
> <property
> name="doubleVal"
> type="double">
> <column name="dVal" precision="12" scale="6"/>
> </property>
> Using the SchemaValidator results in an error:
> org.hibernate.HibernateException: Wrong column type: dVal, expected: double
> at org.hibernate.mapping.Table.validateColumns(Table.java:205)
> at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:938)
> Since there is not appropriate java type for sql type decimal,
> it would be very nice if the above error is omittet,
> when the mapping contains the correct precision and scale
> values.
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1012) Index not created by SchemaUpdate
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012?page=c... ]
Diego Pires Plentz commented on HHH-1012:
-----------------------------------------
>From org.hibernate.cfg.Configuration:
/*broken, 'cos we don't generate these with names in SchemaExport
subIter = table.getIndexIterator();
while ( subIter.hasNext() ) {
Index index = (Index) subIter.next();
if ( !index.isForeignKey() || !dialect.hasImplicitIndexForForeignKey() ) {
if ( tableInfo==null || tableInfo.getIndexMetadata( index.getFilterName() ) == null ) {
script.add( index.sqlCreateString(dialect, mapping) );
}
}
}*/
Someone knows what the meaning of "'cos we don't generate these with names in SchemaExport"?Looking at
org.hibernate.mapping.Index.buildSqlCreateIndexString, it actually use the attribute "name" to build the "create index" script.
> Index not created by SchemaUpdate
> ---------------------------------
>
> Key: HHH-1012
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012
> Project: Hibernate3
> Issue Type: Improvement
> Components: metamodel
> Affects Versions: 3.2.5
> Environment: Windows XP, MySQL/PostgreSQL
> Reporter: Xavier Farret
> Priority: Minor
> Attachments: Indexes.patch
>
>
> i'm using an hbm.xml as describe below and the 'hibernate.hbm2ddl.auto' is egal to update.
> <class table="featurestat" name=".....">
> <id name="id" type="long" column="idFeatureStat">
> <generator class="increment"/>
> </id>
> <properties name="fsUniqueValue" unique="true">
> ....
> </properties>
> <property name="frequency" .../>
> <property name="idFatherFeature" index="FeatStatDocExtSectFeat" not-null="true" type="long" column="..."/>
> ....
> </class>
> Indexes for pk or unique key are well created, but the index explicity named 'FeatStatDocExtSectFeat' is never created. If i put the property 'hibernate.hbm2ddl.auto' in the cfg.xml as 'create' the index is created. But in my case i have to set my property 'hibernate.hbm2ddl.auto' to update.
--
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
18 years, 2 months
[Hibernate-JIRA] Created: (HHH-2582) foncusion of DECIMAL and NUMERIC column types in MySQL5
by Gerald Loeffler (JIRA)
foncusion of DECIMAL and NUMERIC column types in MySQL5
-------------------------------------------------------
Key: HHH-2582
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2582
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.0.ga
Environment: MySQL 5.0.27 InnoDB on windows
Reporter: Gerald Loeffler
when doing schema validation with
<property name="dialect">
org.hibernate.dialect.MySQL5InnoDBDialect</property>
<property name="hbm2ddl.auto">validate</property>
against a table with a DECIMAL/NUMERIC columns, the hibernate schema validator always reports a column type mismatch, saying that it expected "NUMERIC".
this can be explained as follows:
1. MySQL always reports columns created as NUMERIC or DECIMAL as DECIMAL. i.e.,
CREATE TABLE `T` (
`d` decimal(10,0) NULL,
`n` numeric(10,0) NULL
)
will create a table where both columns d and n are of dataype DECIMAL.
2. the hibernate MySQL5InnoDBDialect ultimately inherits from MySQLDialect and this registers the following column type:
registerColumnType(2, "numeric($p,$s)");
which means that when doing schema validation against a column of type DECIMAL hibernate will report a type mismatch.
indeed, if one creates a new hibernate dialect which is identical to MySQL5InnoDBDialect/MySQLDialect in all respects apart from registering the following column typ
registerColumnType(2, "decimal($p,$s)");
then the aforementioned schema validation error is not reported, i.e., schema validation succeeds as expected.
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-1729) Oracle9Dialect LockMode.UPGRADE conflicts with setMaxResults
by Jean CHARBONNEAU (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1729?page=c... ]
Jean CHARBONNEAU commented on HHH-1729:
---------------------------------------
See HHH-759 for further information on this "bug". Doesn't seem to be patched yet as of today.
K
> Oracle9Dialect LockMode.UPGRADE conflicts with setMaxResults
> ------------------------------------------------------------
>
> Key: HHH-1729
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1729
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.1
> Environment: Hibernate 1.1, Oracle 10g release 2 (also tested with 10g release 1).
> Reporter: Mark Lewis
> Priority: Minor
>
> When executing a simple HQL select from in Oracle, attempting to specify LockMode.UPGRADE to generate a "for update" clause while specifying a setMaxResults(10) causes an Oracle-00904: Invalid identifier exception. The same query works fine with several other tested dialects.
> The reason is that the generated SQL refers to a column by its actual column name, instead of the column alias assigned to it. Consider the following example:
> select * from ( select scheduleel0_.elementId as elementId22_ from ScheduleElement scheduleel0_ ) where rownum <= ? for update of scheduleel0_.elementId
> This should be "for update of elementId22_", because "scheduleel0_.elementId" can't be referenced at this scope in the SQL.
> I've dug through the code but I think the fix will require a more knowledge of Hibernate's guts than I've got. The offending SQL is inserted in org.hibernate.sql.ForUpdateFragment.toFragmentString(), but the ForUpdateFragment class doesn't know what the column aliases are for each real column, so it would need some way of getting that information.
> The HQL which causes the problem is as follows:
> from ScheduleElement as element where element.runnable=true and element.scheduleHead=true
> (I don't think it matters, but ScheduleElement is the root of a class hierarchy defined using joined-subclass)
> It is executed using the following Java code:
> session.createQuery(seeAboveForTheQueryString)
> .setLockMode("element", LockMode.UPGRADE)
> .setMaxResults(10)
> .list();
> Here is the bad SQL created from the HQL:
> -- Selecting all columns and left joining on subclass tables omitted for brevity
> select * from ( select scheduleel0_.elementId as elementId22_ from ScheduleElement scheduleel0_ ) where rownum <= ? for update of scheduleel0_.elementId
--
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
18 years, 2 months
[Hibernate-JIRA] Commented: (HHH-759) problem for mixxing setmaxresults and setlockmode
by Jean CHARBONNEAU (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-759?page=co... ]
Jean CHARBONNEAU commented on HHH-759:
--------------------------------------
As Frederic Leitenberger said, it's possible to do a work around this bug, also in Criteria type of query this way :
Criteria criteria = getSession().createCriteria(MyClass.class)
.add(Restrictions.eq("myField", false))
.setLockMode(LockMode.UPGRADE);
// This won't work under hibernate : criteria.setMaxResults(1);
// I've provided the Dialect, but any other mean of detecting it's Oracle would work
if(hibernateDialect.contains("Oracle")) {
criteria.add(Restrictions.sqlRestriction("rownum <= 1"));
}
Adapt this code to other kind of Criteria as needed, this one is for returning a single result.
K
> problem for mixxing setmaxresults and setlockmode
> -------------------------------------------------
>
> Key: HHH-759
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-759
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.2
> Environment: Client:windows2000 professional,jre1.4.2, oracle8client,eclipse3.1-RC3,hibernate-tools 3.0 alpha4a,JBossIDE1.5M1
> Server:Solaris 2.8, oracle 8.1.7
> Reporter: johnhua
> Priority: Minor
>
> there is a problem for mixxing setmaxresults and setlockmode.
> the problem is that "ORA-00904: invalid column name".
> The error info is as the below:
> Hibernate: select * from ( select idmapp0_.RI as col_0_0_ from PCTMNGT.IDMAP_P idmapp0_ where idmapp0_.STATUS=? ) where rownum <= ? for update of idmapp0_.RI
> 14:21:54,076 DEBUG AbstractBatcher:AbstractBatcher.java:365 - preparing statement
> 14:21:54,082 DEBUG AbstractBatcher:AbstractBatcher.java:285 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
> 14:21:54,083 DEBUG AbstractBatcher:AbstractBatcher.java:403 - closing statement
> 14:21:54,090 WARN JDBCExceptionReporter:JDBCExceptionReporter.java:71 - SQL Error: 904, SQLState: 42000
> 14:21:54,091 ERROR JDBCExceptionReporter:JDBCExceptionReporter.java:72 - ORA-00904: invalid column name
> The source code is as the below:
> //query an unused emid for new tone
> query = av_session.createQuery("select v_idmap from IdmapP as v_idmap where v_idmap.status=:v_status");
> query.setCharacter("v_status",EMID_STATUS.UNUSED.charValue());
> query.setMaxResults(1);
> query.setLockMode("v_idmap",LockMode.UPGRADE);
> it = query.iterate();
> if( !it.hasNext() )
> {
> tx.rollback();
> lv_err = "addRing::doAddRingFile: no unused EMID for new tone in idmap. toneid="+av_tone;
> throw new InterfaceErrException(lv_err,INTERFACE_RETCODE.SYSTEM_ERR);
> }
--
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
18 years, 2 months
[Hibernate-JIRA] Resolved: (HHH-1329) SchemaValidator fail when views are involved
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329?page=c... ]
Diego Pires Plentz resolved HHH-1329.
-------------------------------------
Resolution: Fixed
Fix Version/s: 3.2.6
> SchemaValidator fail when views are involved
> --------------------------------------------
>
> Key: HHH-1329
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1329
> Project: Hibernate3
> Issue Type: Bug
> Components: metamodel
> Affects Versions: 3.1
> Environment: database: oracle9i
> hibernate: 3.1
> jdbc driver: ojdbc14-10.2.0.1.0
> Reporter: Yariv Yaari
> Assignee: Diego Pires Plentz
> Fix For: 3.2.6
>
>
> All calls in org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata to java.sql.DatabaseMetaData.getTables set the fourth parameter (types) to {"TABLE"} (defined as a class-level constant).
> In the documentation of getTables it is not defined what are the meanings of the types passed as parameter, only that all the strings must be in java.sql.DatabaseMetaData.getTablesTypes return value. In oracle9i with ojdbc14-10.2.0.1.0.jar views are returned if types contains "VIEW" and not if its {"TABLE"}. It is a major problem only if hibernate.hbm2ddl.auto is set to validate, if it's set to update it will log some errors (since it can't create or alter the table, there is a view with this name) but it won't fail the deployment, and since in SQL views are treated as tables, there will be no more problems.
> It should be checked for more databases/jdbc drivers.
> It is not obvious what should be the solution.
> Pass {"TABLE","VIEW"} always? Pass them if they are in getTableTypes?
> Put it as part of the dialect, default to {"TABLE"} and change it in oreacle-dialects?
--
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
18 years, 3 months