[Hibernate-JIRA] Closed: (HBX-578) <hbm2hbmxml/> doesn't take into account the revengfile property for changing properties names on mapping
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-578?page=all ]
Max Rydahl Andersen closed HBX-578:
-----------------------------------
Resolution: Incomplete
no further info - assuming mysql metadata issue.
> <hbm2hbmxml/> doesn't take into account the revengfile property for changing properties names on mapping
> --------------------------------------------------------------------------------------------------------
>
> Key: HBX-578
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-578
> Project: Hibernate Tools
> Type: Bug
> Components: reverse-engineer
> Versions: 3.1beta4
> Reporter: David Leal
> Priority: Critical
> Attachments: ant.log
>
>
> When using the property revengfile from <jdbcconfiguration> in order to change some output on the generated file such changes are not considered on the generated *.hbml.xml file.
> Let's say the following simple ant build file in order to check the fail:
> =============
> ant build.xml file
> =============
> <project name = "hibernate-test">
> <property name = "lib.dir" location="lib"/>
> <path id="lib.classpath">
> <fileset dir="${lib.dir}">
> <include name="*.jar"/>
> </fileset>
> </path>
> <taskdef
> name="hibernatetool"
> classname="org.hibernate.tool.ant.HibernateToolTask"
> classpathref="lib.classpath"
> />
> <target name = "hibernatetool">
> <hibernatetool destdir=".">
> <classpath>
> <path refid="lib.classpath"/>
> </classpath>
> <jdbcconfiguration
> revengfile ="hibernate.reveng.xml"
> configurationfile ="hibernate.cfg.xml"
> />
> <hbm2hbmxml/>
> </hibernatetool>
> </target>
> </project>
> ================
> hibernate.reveng.xml file:
> ===================
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-reverse-engineering
> SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
> <!--Configuration file for controlling the inverse generation process from the Database to
> *.hbml and *.java files-->
> <hibernate-reverse-engineering>
> <table-filter
> match-name="credit_entity"
> exclude="false"
> />
> <table name="credit_entity">
> <column name="name" property="theName" type="String" />
> </table>
> </hibernate-reverse-engineering>
> ================
> hibernate.cfg.xml file:
> ================
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-configuration PUBLIC
> "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
> <hibernate-configuration>
> <session-factory name="lra">
> <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
> <property name="hibernate.connection.password">dev00</property>
> <property name="hibernate.connection.url">jdbc:mysql://localhost/lra</property>
> <property name="hibernate.connection.username">dev</property>
> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
> </session-factory>
> </hibernate-configuration>
> ================
> database script file:
> ================
> CREATE TABLE credit_entity (
> nif VARCHAR(10) NOT NULL
> , name VARCHAR(40) NOT NULL
> , PRIMARY KEY (nif)
> );
> ALTER TABLE credit_entity COMMENT='Credit entity information';
> ================
> and the output file is:
> ================
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <!-- Generated 07-feb-2006 0:16:45 by Hibernate Tools 3.1.0 beta3 -->
> <hibernate-mapping>
> <class name="CreditEntity" table="credit_entity" catalog="lra">
> <id name="nif" type="string">
> <column name="nif" length="10" />
> <generator class="assigned" />
> </id>
> <property name="name" type="string">
> <column name="name" length="40" not-null="true" />
> </property>
> </class>
> </hibernate-mapping>
> So, the property associated with column "name" will be mapped with the same name.
--
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, 8 months
[Hibernate-JIRA] Closed: (HBX-560) Support of Cacase Insert when creating mapping files
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-560?page=all ]
Max Rydahl Andersen closed HBX-560:
-----------------------------------
Resolution: Rejected
use forum.hibernate.org for usage questions.
> Support of Cacase Insert when creating mapping files
> ----------------------------------------------------
>
> Key: HBX-560
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-560
> Project: Hibernate Tools
> Type: New Feature
> Components: reverse-engineer
> Environment: Hibernate Tools Does Not Support Cascade Inserts/Updates
> Reporter: tony anecito
> Priority: Blocker
>
>
> Recently on the Hibernate forum i gave the following example which in summary is a parent/child relationship where there can be many children. It was mentioned that cascading was not currently supported. I am suspecting it is not a Hibernate issue but a missing enhancement for the tools so that the mapping files are generated with cascade support for inserts.
> For example we have an AutoMaker class generated by Hibernate Tools
> public class AutoMaker {
> private Set Car cars;
> AutoMaker() {}
> public void setCars(Car vo) {
> car = vo;
> }
> public Car getCars() {
> return car;
> }
> }
> public class Car {
> private long serialNumber;
> private String color;
> public Car() {}
> public setSerialNumber(long id) {
> serialNumber = id;
> }
> public long getSerialNumber() {
> return serialNumber;
> }
> public void setColor(String val) {
> color = val;
> }
> public String getColor() {
> return color;
> }
> }
> So. I have several questions:
> 1. Assuming Hibernate Tools maps the serialNumber value to the primary column in the table Car does Hibernate Tools tie the Car instance such that if I populate the serialNumber attribute in an instance of Car and add that to an instance of HashSet and that instance is passed to the setCar in an instance the AutoMaker class that an entry in the Car table will be inserted or updated when an instance of AutoMaker is passed to a Hibernate seesion and committed?
> so:
> AutoMaker autoMaker = new AutoMaker();
> Car car = new Car();
> car.setSerialNumber(10);
> HashSet cars = new HashSet();
> cars.add(car);
> autoMaker.setCars(cars);
> session.saveOrUpdate(cars);
> session.flush();
> session.connection.commit();
> So this should work because of the mapping generated by the tools or is there some key I need to generate for the set so when I add the cars to the HashSet I provide some sort of key in addition to the car object?
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-2074) MySQL GROUP BY issue (with parenthesis)
by Eric Sauve (JIRA)
MySQL GROUP BY issue (with parenthesis)
---------------------------------------
Key: HHH-2074
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2074
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.0.5
Environment: Win2K
Reporter: Eric Sauve
a query goes from
[demo] 10:21:13 DEBUG XXXReportingDAOHibernate.doInHibernate(96) | select entreprise as entreprise, businessUnit as BU, devise as devise, sum(balance.balanceAmount) from Balance balance join balance.account.currency devise join balance.account.company entreprise join balance.account.users utilisateur join entreprise.bus businessUnit where balance.balanceDate = :date and utilisateur.userId = :iduser group by entreprise.idCompany, entreprise.country, entreprise.groups, entreprise.companyName, entreprise.contactName, entreprise.contactMail, entreprise.contactPhone, entreprise.address, businessUnit.idBu, businessUnit.buName, businessUnit.buDescription, businessUnit.groups, devise.idCurrency, devise.currencyName, devise.currencyDesc
to:
[demo] 10:21:13 WARN DispatcherServlet.processHandlerException(883) | Handler execution resulted in exception - forwarding to resolved error view
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select company4_.ID_COMPANY as col_0_0_, businessun9_.ID_BU as col_1_0_, currency2_.ID_CURRENCY as col_2_0_, sum(balance0_.BALANCE_AMOUNT) as col_3_0_, company4_.ID_COMPANY as ID1_0_, businessun9_.ID_BU as ID1_1_, currency2_.ID_CURRENCY as ID1_2_, company4_.ID_COUNTRY as ID2_6_0_, company4_.ID_GROUP as ID3_6_0_, company4_.COMPANY_NAME as COMPANY4_6_0_, company4_.address as address6_0_, company4_.city as city6_0_, company4_.province as province6_0_, company4_.country as country6_0_, company4_.postal_code as postal9_6_0_, company4_.COMPANY_CONTACT_MAIL as COMPANY10_6_0_, company4_.COMPANY_CONTACT_NAME as COMPANY11_6_0_, company4_.COMPANY_CONTACT_PHONE as COMPANY12_6_0_, businessun9_.ID_GROUP as ID2_23_1_, businessun9_.BU_DESCRIPTION as BU3_23_1_, businessun9_.BU_NAME as BU4_23_1_, currency2_.CURRENCY_DESC as CURRENCY2_12_2_, currency2_.CURRENCY_NAME as CURRENCY3_12_2_ from BALANCE balance0_ inner join ACCOUNT account1_ on balance0_.ID_ACCOUNT=account1_.ID_ACCOUNT inner join CURRENCY currency2_ on account1_.ID_CURRENCY=currency2_.ID_CURRENCY inner join COMPANY company4_ on account1_.ID_COMPANY=company4_.ID_COMPANY inner join LIST_BU_COMPANY bus8_ on company4_.ID_COMPANY=bus8_.ID_COMPANY inner join BUSINESS_UNIT businessun9_ on bus8_.ID_BU=businessun9_.ID_BU inner join RIGHT_ACCOUNT users6_ on account1_.ID_ACCOUNT=users6_.ID_ACCOUNT inner join app_user user7_ on users6_.ID_USER=user7_.ID_USER where balance0_.BALANCE_DATE=? and user7_.ID_USER=? group by company4_.ID_COMPANY , company4_.ID_COUNTRY , company4_.ID_GROUP , company4_.COMPANY_NAME , company4_.COMPANY_CONTACT_NAME , company4_.COMPANY_CONTACT_MAIL , company4_.COMPANY_CONTACT_PHONE , (company4_.address, company4_.city, company4_.province, company4_.country, company4_.postal_code) , businessun9_.ID_BU , businessun9_.BU_NAME , businessun9_.BU_DESCRIPTION , businessun9_.ID_GROUP , currency2_.ID_CURRENCY , currency2_.CURRENCY_NAME , currency2_.CURRENCY_DESC]; SQL state [21000]; error code [1241]; Operand should contain 1 column(s); nested exception is java.sql.SQLException: Operand should contain 1 column(s)
java.sql.SQLException: Operand should contain 1 column(s)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3004)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1128)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1222)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.planaxis.swifter.dao.hibernate.XXXReportingDAOHibernate$1.doInHibernate(XXXReportingDAOHibernate.java:98)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:314)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:287)
at com.XXX.swifter.dao.hibernate.XXXReportingDAOHibernate.getReporting01(XXXReportingDAOHibernate.java:114)
is caused by the additional parenthesis in the GROUP BY CLAUSE
, (company4_.address, company4_.city, company4_.province, company4_.country, company4_.postal_code) ,
is this a dev/configuration issue or a bug ?
Regards
--
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, 8 months
[Hibernate-JIRA] Created: (HBX-749) Reverse engineer of many-to-many association MySQL) does not put table attribute in hbm.xml file
by Vaughn Butt (JIRA)
Reverse engineer of many-to-many association MySQL) does not put table attribute in hbm.xml file
------------------------------------------------------------------------------------------------
Key: HBX-749
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-749
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta7
Environment: Hibernate : 3.2.0.cr4
Hibernate Tools : 3.2.0.beta7
MySQL database : 5.0.24-community-nt via TCP/IP
MySQL Connector : mysql-connector-java-3.1.13-bin.jar
Eclipse : 3.2
Reporter: Vaughn Butt
Priority: Minor
Attachments: Person.hbm.xml, Role.hbm.xml, linktest_ddl.sql
The problem appears to be that the hbm.xml file generated for two classes that have a Many-To-Many relationship does not include the attribute for the link (aka association) table name.
see http://forum.hibernate.org/viewtopic.php?t=964363
When I tried to navigate across the association using the generated hbm.xml file I got this stack trace (snipped):
WARNING: SQL Error: 1146, SQLState: 42S02
5/09/2006 14:00:24 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Table 'blah.enginemodels' doesn't exist
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.acme.model.ChassisModel.engineModels#1]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
When I added the table="<linktablename>" attribute to the "set" element the navigation succeeded.
<set name="roles" inverse="true" table="lt_role_person">
<key>
<column name="person_pkid" not-null="true">
<comment></comment>
</column>
</key>
<many-to-many entity-name="nz.co.linktest.model.Role">
<column name="role_pkid" not-null="true">
<comment></comment>
</column>
</many-to-many>
</set>
I don't think the stuff in the log is related but I could be wrong so...
The file workspace\org.hibernate.eclipse.console\hibernate-tools.log had something like
2006-09-02 17:59:32,812 0 [ Worker-5] WARN ibernate.cfg.reveng.JDBCReader - The JDBC driver didn't report any primary key columns in lt_e_model_c_model. Asking rev.eng. strategy
2006-09-02 17:59:32,812 0 [ Worker-5] WARN ibernate.cfg.reveng.JDBCReader - Rev.eng. strategy did not report any primary key columns for lt_e_model_c_model
2006-09-02 18:09:08,093 575281 [ Worker-1] WARN ibernate.cfg.reveng.JDBCReader - The JDBC driver didn't report any primary key columns in lt_e_model_c_model. Asking rev.eng. strategy
2006-09-02 18:09:08,109 575297 [ Worker-1] WARN ibernate.cfg.reveng.JDBCReader - Rev.eng. strategy did not report any primary key columns for lt_e_model_c_model
2006-09-03 08:03:53,718 0 [ Worker-9] WARN ibernate.cfg.reveng.JDBCReader - The JDBC driver didn't report any primary key columns in lt_e_model_c_model. Asking rev.eng. strategy
2006-09-03 08:03:53,750 32 [ Worker-9] WARN ibernate.cfg.reveng.JDBCReader - Rev.eng. strategy did not report any primary key columns for lt_e_model_c_model
2006-09-03 16:01:57,687 0 [ Worker-3] WARN ibernate.cfg.reveng.JDBCReader - The JDBC driver didn't report any primary key columns in lt_e_model_c_model. Asking rev.eng. strategy
2006-09-03 16:01:58,125 438 [ Worker-3] WARN ibernate.cfg.reveng.JDBCReader - Rev.eng. strategy did not report any primary key columns for lt_e_model_c_model
2006-09-03 16:05:27,312 209625 [ Worker-3] WARN ibernate.cfg.reveng.JDBCReader - The JDBC driver didn't report any primary key columns in lt_e_model_c_model. Asking rev.eng. strategy
2006-09-03 16:05:27,406 209719 [ Worker-3] WARN ibernate.cfg.reveng.JDBCReader - Rev.eng. strategy did not report any primary key columns for lt_e_model_c_model
where lt_e_model_c_model is like the name of the link table that the reveng originally "failed" on. Interestingly there does not seem to be any similar log entries for the attached example.
The file workspace\org.hibernate.eclipse.console\hibernate-console.xml-8 had something (some other stuff removed) like
<?xml version="1.0" encoding="UTF-8"?><hibernate-console><configuration name="Linktest"><hibernate-config-xml location="/Linktest/src/hibernate.cfg.xml"/><classpath><path location="/Linktest/bin"/><path location="/Linktest/lib/mysql-connector-java-3.1.13-bin.jar"/></classpath></configuration></hibernate-console>
--
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, 8 months
[Hibernate-JIRA] Created: (HBX-754) hbm2hbmxml generates xml for subclasses that doesn't validate under the dtd
by Bruce Cota (JIRA)
hbm2hbmxml generates xml for subclasses that doesn't validate under the dtd
---------------------------------------------------------------------------
Key: HBX-754
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-754
Project: Hibernate Tools
Type: Patch
Components: ant
Versions: 3.2beta7
Reporter: Bruce Cota
Priority: Minor
Attachments: patch, test.tar
When generating xml for subclasses, hbm2hbmxml makes the following errors:
1) A table attribute is always generated, but this is not a valid attribute for the subclass element
2) A discriminator-value attribute is always generated, but this is not a valid attribute for the
union-subclass element.
3) An Id element is generated, but this is not valid for any of the three different kinds of subclass
elemtns.
A test case (test.jar) is attached demonstrating a subclass element thatis generated with a table attribute
and an id element.
A suggested patch is also attached. It entails small changes to persistentclas.hbm.ftl and three
simple helper methods added to Cfg2HbmTool.java to support the persistentclass.hbm.ftl changes.
--
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, 8 months