Closed judithek closed 9 years ago
Hm. If a database already contains the tables and indexes, it is ok to turn this off
(although "validate" is probably better to check if the schema matches the expecations
of Hibernate), but if the database is empty and must be filled from scratch, e.g. when
creating a new Uby database, I believe this must be set at least to "update".
Logging may be reduced by configuring a different log level for hibernate.
Original issue reported on code.google.com by richard.eckart
on 2014-09-05 10:54:29
we can discuss this in the meeting
more background info:
the Hibernate configuration:
Configuration cfg = HibernateConnect.getConfiguration(dbConfig);
is called in constructors of 3 different classes:
1) query mode: in the Uby class
2) export mode: in the DBToXMLTransformer
3) import mode: in the XMLToDBTransformer
Original issue reported on code.google.com by eckle.kohler
on 2014-09-08 07:04:43
Changing hbd2ddl to "validate" yields multiple failing test cases in uby-testing. I
have identified (at least) two issues:
1) Our UBY schema definition contains database indices with duplicate names. This is
no issue for MySQL (where index names are table-specific), but for H2 which relies
on unique names for the whole database/schema. I suggest renaming _all_ our indexes
using the schema:
* <table-name>_<field-name>_IDX (for single field indexes)
* <table-name>_<logical-name>_IDX (for complex indexes)
I tried that in my developer version which cleans up all errors during create table
in the uby-testing test cases. I can deliver a patch for that if wanted.
2) There seems to be an incompatibility in the Hibernate to H2 data type mapping. For
our columns typed "text", Hibernated raises a validation exception such as:
org.hibernate.HibernateException: Wrong column type in TEST.PUBLIC.TEXTREPRESENTATION_CONTEXT
for column writtenText. Found: varchar, expected: longvarchar
at org.hibernate.mapping.Table.validateColumns(Table.java:377)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1275)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:506)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
That is, we would need to tell Hibernate to construct the column as longvarchar instead
of varchar (which should make no difference for H2 in-memory databases(?)). Alternatively,
we should tell Hibernate to accept a varchar even if longvarchar is expected. However,
I have no idea how to do that. There are a few people on the Web reporting a similar
issue but without a proper solution, see:
* https://hibernate.atlassian.net/browse/HHH-6582
* https://forum.hibernate.org/viewtopic.php?f=1&t=1012092
Original issue reported on code.google.com by chmeyer.de
on 2014-09-11 15:54:27
Committed (1).
Original issue reported on code.google.com by chmeyer.de
on 2014-10-09 13:20:15
(No text was entered with this change)
Original issue reported on code.google.com by eckle.kohler
on 2014-10-09 17:27:04
Introduced a custom UBYH2Dialect which treats longvarchar fields as varchar(maxint)
in H2 schema validation/creation. This fixes the test case and the issue.
Original issue reported on code.google.com by chmeyer.de
on 2014-10-10 08:58:15
Reopened: In MySQL, validation of boolean fields fails with "Wrong column type Found:
bit, expected: boolean".
* https://hibernate.atlassian.net/browse/HHH-6935
* https://github.com/BroadleafCommerce/BroadleafCommerce/issues/189
Original issue reported on code.google.com by chmeyer.de
on 2014-10-10 09:55:33
for H2 validation fails -
I therefore turned off the validation mode again in order to be able to use a H2 DB
Original issue reported on code.google.com by eckle.kohler
on 2014-10-20 18:35:29
In case you still have the error/log messages around that would be really helpful to
trace down the errors. I can imagine that it has something to do with the alignments,
but without trace or sample code this is hard to detect.
Original issue reported on code.google.com by chmeyer.de
on 2014-10-21 15:33:19
After talking to Judith: the H2 db had most probably an old format. Switched back to
validate unless there are further problems.
Original issue reported on code.google.com by chmeyer.de
on 2014-10-31 10:02:40
Original issue reported on code.google.com by
eckle.kohler
on 2014-09-04 17:13:40