[Hibernate-JIRA] Updated: (HBX-621) meta attribute of scope-get/set & inherit bug
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-621?page=all ]
Max Rydahl Andersen updated HBX-621:
------------------------------------
Fix Version: 3.2beta8
need to evaluate/verify
> meta attribute of scope-get/set & inherit bug
> ---------------------------------------------
>
> Key: HBX-621
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-621
> Project: Hibernate Tools
> Type: Bug
> Versions: 3.1beta4
> Environment: Hiberante 3.1.2
> Hibernate Tools 3.1 beta 4
> Reporter: Neil Buesing
> Fix For: 3.2beta8
>
>
> An inhertiable class level meta attribute of scope-get and scope-set cannot be overridden within a property. Instead some string concat is being applied. This is different behavior than with hibernate tools 2.1.3 and it is a potential bug (or at least a change of behavior).
> Hibernate 3 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="com.hibernate">
> <class mutable="true" lazy="false" name="com.hibernate.Test" table="TEST">
> <meta attribute="scope-get">private</meta>
> <meta attribute="scope-set">private</meta>
> <id name="id" column="ID" type="long">
> <generator class="assigned" />
> </id>
> <property name="col1" column="COL1" type="java.lang.String">
> <meta attribute="scope-get">public</meta>
> </property>
> <property name="col2" column="COL2" type="java.lang.String">
> <meta attribute="scope-set"></meta>
> <meta attribute="scope-get">public</meta>
> </property>
> <property name="col3" column="COL3" type="java.lang.String">
> </property>
> <property name="col4" column="COL4" type="java.lang.String">
> </property>
> </class>
> </hibernate-mapping>
> Hibernate 3 Generated File
> package com.hibernate;
> // Generated Mar 16, 2006 10:00:19 AM by Hibernate Tools 3.1.0.beta4
> /**
> * Test generated by hbm2java
> */
> public class Test implements java.io.Serializable {
> // Fields
> private long id;
> private String col1;
> private String col2;
> private String col3;
> private String col4;
> // Constructors
> /** default constructor */
> public Test() {
> }
> /** minimal constructor */
> public Test(long id) {
> this.id = id;
> }
>
> /** full constructor */
> public Test(long id, String col1, String col2, String col3, String col4) {
> this.id = id;
> this.col1 = col1;
> this.col2 = col2;
> this.col3 = col3;
> this.col4 = col4;
> }
>
> // Property accessors
> privatepublicpublic long getId() {
> return this.id;
> }
>
> private void setId(long id) {
> this.id = id;
> }
> privatepublicpublic String getCol1() {
> return this.col1;
> }
>
> private void setCol1(String col1) {
> this.col1 = col1;
> }
> privatepublicpublic String getCol2() {
> return this.col2;
> }
>
> private void setCol2(String col2) {
> this.col2 = col2;
> }
> privatepublicpublic String getCol3() {
> return this.col3;
> }
>
> private void setCol3(String col3) {
> this.col3 = col3;
> }
> privatepublicpublic String getCol4() {
> return this.col4;
> }
>
> private void setCol4(String col4) {
> this.col4 = col4;
> }
> }
> Hibernate 2 Mapping File
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
> <hibernate-mapping package="com.hibernate">
> <class mutable="true" lazy="false" name="com.hibernate.Test" table="TEST">
> <meta attribute="scope-get">private</meta>
> <meta attribute="scope-set">private</meta>
> <id name="id" column="ID" type="long">
> <generator class="assigned" />
> </id>
> <property name="col1" column="COL1" type="java.lang.String">
> <meta attribute="scope-get">public</meta>
> </property>
> <property name="col2" column="COL2" type="java.lang.String">
> <meta attribute="scope-set"></meta>
> <meta attribute="scope-get">public</meta>
> </property>
> <property name="col3" column="COL3" type="java.lang.String">
> </property>
> <property name="col4" column="COL4" type="java.lang.String">
> </property>
> </class>
> </hibernate-mapping>
> Hibernate 2 Generated File
> package com.hibernate;
> import java.io.Serializable;
> import org.apache.commons.lang.builder.ToStringBuilder;
> /** @author Hibernate CodeGenerator */
> public class Test implements Serializable {
> /** identifier field */
> private Long id;
> /** nullable persistent field */
> private String col1;
> /** nullable persistent field */
> private String col2;
> /** nullable persistent field */
> private String col3;
> /** nullable persistent field */
> private String col4;
> /** full constructor */
> public Test(Long id, String col1, String col2, String col3, String col4) {
> this.id = id;
> this.col1 = col1;
> this.col2 = col2;
> this.col3 = col3;
> this.col4 = col4;
> }
> /** default constructor */
> public Test() {
> }
> /** minimal constructor */
> public Test(Long id) {
> this.id = id;
> }
> private Long getId() {
> return this.id;
> }
> private void setId(Long id) {
> this.id = id;
> }
> public String getCol1() {
> return this.col1;
> }
> private void setCol1(String col1) {
> this.col1 = col1;
> }
> public String getCol2() {
> return this.col2;
> }
> void setCol2(String col2) {
> this.col2 = col2;
> }
> private String getCol3() {
> return this.col3;
> }
> private void setCol3(String col3) {
> this.col3 = col3;
> }
> private String getCol4() {
> return this.col4;
> }
> private void setCol4(String col4) {
> this.col4 = col4;
> }
> public String toString() {
> return new ToStringBuilder(this)
> .append("id", getId())
> .toString();
> }
> }
> see also forum topic http://forum.hibernate.org/viewtopic.php?t=956894#2296725
--
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, 4 months
[Hibernate-JIRA] Closed: (HBX-626) New meta tag for specifying the class that implements equals algorithm
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-626?page=all ]
Max Rydahl Andersen closed HBX-626:
-----------------------------------
Resolution: Rejected
i follow the idea, but encouraging alot of static methods for implementing a equals is not something i'm keen on.
rejecting until a better suggestion (and patch) becomes available.
p.s. its trivial to implement this specific wanted behavior via customizing the templates.
> New meta tag for specifying the class that implements equals algorithm
> ----------------------------------------------------------------------
>
> Key: HBX-626
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-626
> Project: Hibernate Tools
> Type: Improvement
> Components: hbm2java
> Versions: 3.1beta4
> Reporter: David Leal
>
>
> Just to suggest a usefull new meta tag in order to specify the way to implement the equal algorithm. Now the meta tags allow to specify which property will be considered on the equals method, but what about if I have a comlex algorithm for determine if two object are equals or not.
> The solution for the moment is to extend the generated domain class an override the equals method, another ugly solution would be modify the generated java class, which generate problems in order to mantain the code.
> My suggestion will be a meta attribute on the class node in order to define the which class will implement the equals method, for example:
> <class name="a.b.c.domain.Sample" table="sample">
> <meta attribute="equal-class">a.b.c.domain.SampleEquals</meta>
> </class>
> so the generated class will be:
> public boolean equals(Object other) {
> return SampleEquals.isEquals(this, other);
> }
> where SampleEquals should be an utility class with a single static method: isEquals. Otherwise a more professional solution could be a regular class that should implement a given interface for implementing the equals algorithm.
> Now on the SampleEquals.isEquals method, your are free to implement a very complicated algorithm about how to make a desition if to objects are equals or not.
> Thanks in advance,
> David
--
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, 4 months
[Hibernate-JIRA] Updated: (HBX-612) Allow to specify a NamingStrategy to a console configuration
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-612?page=all ]
Max Rydahl Andersen updated HBX-612:
------------------------------------
Fix Version: 3.2beta8
> Allow to specify a NamingStrategy to a console configuration
> ------------------------------------------------------------
>
> Key: HBX-612
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-612
> Project: Hibernate Tools
> Type: Improvement
> Components: consoleconfiguration
> Versions: 3.1beta2
> Environment: Eclipse webtools 1.0
> Hibernate console plugin version: 3.1.0 beta2
> Hibernate 3.1
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
> Windows XP
> Reporter: Benjamin Francisoud
> Fix For: 3.2beta8
>
>
> See forum topic: set NamingStrategy for hbm2ddl
> http://forum.hibernate.org/viewtopic.php?t=947305&start=0&postdays=0&post...
> the 01 Mar 2006 entry
> ---
> When doing a schema export (or schema update) within the console perspective under hibernate eclipse plugin
> How can I set the NamingStrategy to ImprovedNamingStrategy ?
> I already do this in my application code, but when I use the plugin, I have errors or duplicated tables for example:
> - PHONENUMBER (created by the plugin)
> - PHONE_NUMBER (created by my code using ImprovedNamingStrategy)
> Adding an input field in the console configuration would be a good place in my opinion...
> My hibernate.cfg.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <hibernate-configuration>
> <session-factory name="sessionFactory">
> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
> <property name="hibernate.cache.region_prefix">hibernate.app</property>
> <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
> <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
> <property name="hibernate.connection.url">jdbc:oracle:thin:@host:1591:BASE</property>
> <property name="hibernate.default_schema">LOGIN</property>
> <property name="hibernate.connection.username">LOGIN</property>
> <property name="hibernate.connection.password">PASSWORD</property>
> <property name="hibernate.connection.pool_size">1</property>
> <property name="show_sql">true</property>
> <property name="hibernate.hbm2ddl.auto">update</property>
>
> <!-- mapping files -->
> <mapping resource="package/Address.hbm.xml"/>
> <mapping resource="package/Person.hbm.xml"/>
> <mapping resource="package/PersonAddress.hbm.xml" />
> <mapping resource="package/PhoneNumber.hbm.xml" />
> </session-factory>
> </hibernate-configuration>
--
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, 4 months
[Hibernate-JIRA] Closed: (HBX-608) Java property name not correctly generated
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-608?page=all ]
Max Rydahl Andersen closed HBX-608:
-----------------------------------
Resolution: Rejected
behavior fully customizable via reveng strategy
use forum.hibernate.org for usage questions.
> Java property name not correctly generated
> ------------------------------------------
>
> Key: HBX-608
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-608
> Project: Hibernate Tools
> Type: Bug
> Components: hbm2java
> Versions: 3.1beta4
> Environment: - Linux Fedora Core 3.
> - Oracle10. Driver ojdbc14.jar
> - JBossIDE nightly build of 25.02.2006
> Reporter: berdat joseph
>
>
> Hi,
> I've the following tables:
> INSTRUMENT(
> ID (PK),
> BASE_CURRENCY (FK),
> UNDERLYING_CURRENCY
> )
> CURRENCY(
> ID(PK),
> ISO_CODE_3,
> NAME
> )
> Where relation between the tables are as follow:
> INSTRUMENT.BASE_CURRENCY -0..1-> CURRENCY.ID
> INSTRUMENT.UNDERLYING_CURRENCY -0..1-> CURRENCY.ID
> When running hibernate tool, I'm getting the following code generation:
> @Entity
> @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
> @DiscriminatorColumn(name="DISCRIMINATOR", discriminatorType=DiscriminatorType.INTEGER)
> @Table(name="INSTRUMENT", uniqueConstraints = { @UniqueConstraint( columnNames = { "CODE" } ) })
> public class Instrument implements java.io.Serializable {
> // Fields
> private long id;
> private InstrumentType instrumentType;
> private Currency currencyByBaseCurrency;
> private Currency currencyByUnderlyingCurrency;
> ...
> My question is why the names for the currencies are currencyByBaseCurrency, currencyByUnderlyingCurrency
> when I'm expecting to have baseCurrency and underlyingCurrency?
> Best 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
18 years, 4 months