[Hibernate-JIRA] Created: (HHH-2874) Problem with join table mapping
by vinod dev (JIRA)
Problem with join table mapping
-------------------------------
Key: HHH-2874
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2874
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Reporter: vinod dev
Priority: Minor
I have a the below problem while mapping in hibernate.
I am mapping a many - to - many relation.
Table A Table B
Field X Field A
Field Y Field Y
Field Z Field C
Table C(Many - to - Many or Combination Table)
Field X
Field Y
Field A
Mapping part
<class name="Table A's class">
<set name="tests" table="Table C" cascade = "all">
<key >
<column name="Field X" ></column>
<column name="Field Y"></column>
</key>
<many-to-many class="Table B's Class" >
<column name="Field A"/>
<column name="Field Y"/>
</many-to-many>
</set>
</class>
<class name="Table B's class">
.
.
.
</class>
Bold indicates composite primary key.
I get Repeated column in mapping for collection.
If I remove field Y from either many-to-many or key I get this error.
Foreign key (FKD3FBFB2875481687: must have same number of columns as the referenced primary key
I would like to know if there is any way we can get rid of this.
Please let me know if detail is required.
Thanks
--
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
17 years, 2 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Max Rydahl Andersen commented on HBX-524:
-----------------------------------------
Ok - later.
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 2 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Leonardo Pinho (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Leonardo Pinho commented on HBX-524:
------------------------------------
Sorry, but I'm going to switch to HibernateSynch (http://hibernatesynch.sourceforge.net) or HiberObjects(http://objectgeneration.com/eclipse/index.html).
Tks!
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 2 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Max Rydahl Andersen commented on HBX-524:
-----------------------------------------
when someone implement it ;)
feel free to provide a patch.
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 2 months
[Hibernate-JIRA] Commented: (HBX-524) Reverse of one-to-one relationships
by Leonardo Pinho (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-524?page=co... ]
Leonardo Pinho commented on HBX-524:
------------------------------------
Any idea when is this going to be fixed?
Thanks!
> Reverse of one-to-one relationships
> -----------------------------------
>
> Key: HBX-524
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-524
> Project: Hibernate Tools
> Issue Type: Bug
> Components: reverse-engineer
> Affects Versions: 3.1beta2
> Environment: HIbernate 3.1, Oracle 9i
> Reporter: Andrea Cattani
>
> Hi,
> I've posted this issue to the forum and got this response from Max, Hibernate Team:
> "the reveng tools does not detect this as a one-to-one. it probably could, so add a request/patch to jira."
> The problem I've faced is the following:
> I have two tables, let's say
> - table A with column ID (PK) and other fields
> - table B with column ID (PK) and other fields
> table B has a foreign key constraint against table A, from column ID to column ID (one-to-one)
> When I reverese the tables with the HibernateTools I have such a resultant mapping for table B:
> <class name="B" table="B" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned" />
> </id>
> <[b]many-to-one name[/b]="a" class="A" update="false" insert="false" fetch="select">
> <column name="ID" length="12" not-null="true" unique="true" />
> </many-to-one>
> ....
> And this one for table A:
> <class name="A" table="A" schema="SCHEMA">
> <id name="id" type="string">
> <column name="ID" length="12" />
> <generator class="assigned"/>
> </id>
> <set name="b" inverse="true">
> <key>
> <column name="ID" length="12" not-null="true" unique="true" />
> </key>
> <[b]one-to-many[/b] class="B" />
> </set>
> </class>
> while I was expecting something like:
> [i]<one-to-one name="a" class="A" constrained="true"/>[/i]
> in table B, and the same (or nothing) in table A
> Thank you
> Andi
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2593) Keyword UNION is prefixed with "this_." in filter conditions
by Frederic Leitenberger (JIRA)
Keyword UNION is prefixed with "this_." in filter conditions
------------------------------------------------------------
Key: HHH-2593
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2593
Project: Hibernate3
Issue Type: Bug
Components: query-hql, query-sql
Affects Versions: 3.2.1
Environment: Oracle 10g: org.hibernate.dialect.OracleDialect
Suse Linux
Hibernate: 3.2.1.ga
Hibernate Annotations: 3.2.1.GA
Reporter: Frederic Leitenberger
Priority: Trivial
I need to use a UNION-Subquery in a Filter condition unless HHH-298 is solved.
But anyway, when using the keyword "union" in the Filter condition it is prefixed with "this_.".
For instance, this ...
@Filter(name = "resellerFilter", condition = "(select cu.resellerId from Customer cu, GeoNumber gn where (cu.id = gn.customerId and gn.id = this_.geoNumberId) UNION select cu.resellerId from Customer cu where cu.detemeTemplateId = this_.id) in (null, :resellerIds)")
... produces this ...
select
...
from
DeTeMe this_
where
(
select
cu.resellerId
from
Customer cu,
GeoNumber gn
where
(
cu.id = gn.customerId
and gn.id = this_.geoNumberId
) this_.UNION select
cu.resellerId
from
Customer cu
where
cu.detemeTemplateId = this_.id
) in (
null, ?
)
and this_.id = ?
--
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
17 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1423) ParameterParser bug - ordinal parameter mismatch
by Sandeep Tamhankar (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423?page=c... ]
Sandeep Tamhankar commented on HHH-1423:
----------------------------------------
I believe I'm running into a different flavor of this issue. Here's some HQL that didn't quite do what I wanted, but it satisfied most of my needs:
select foo
from Foo foo
left join foo.bar bar1
left join foo.baz baz1
left join foo.bar bar2
left join foo.baz baz2
where ((bar1.name = :param_1 and bar1.some_field = :param_2)
or (baz1.name = :param_1 and baz1.some_field = :param_2))
and ((bar2.name = :param_3 and bar2.some_field = :param_4)
or (baz2.name = :param_3 and baz2.some_field = :param_4))
In this example, foo.bar and foo.baz are collections.
This is a generated query, but it doesn't quite fit the structure I want because sometimes I want to find objects Foo whose collections bar and baz don't contain elements with some name. I thought I could get there like this:
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.baz baz1 with baz1.name = :param_1
where bar1.name is null and baz1.name is null;
which means my first query would look like this:
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.baz baz1 with baz1.name = :param_1
left join foo.bar bar2 with bar2.name = :param_3
left join foo.baz baz2 with baz2.name = :param_3
where ((bar1.some_field = :param_2)
or (baz1.some_field = :param_2))
and ((bar2.some_field = :param_4)
or (baz2.some_field = :param_4))
basically, just move the 'name' references in the predicate up to the join clause. This failed (returned no results). However, when I switched the join order to do all of the bar's before baz's, it worked. I then tried all baz's before bar's, and that worked, too.
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.bar bar2 with bar2.name = :param_3
left join foo.baz baz1 with baz1.name = :param_1
left join foo.baz baz2 with baz2.name = :param_3
where ((bar1.some_field = :param_2)
or (baz1.some_field = :param_2))
and ((bar2.some_field = :param_4)
or (baz2.some_field = :param_4))
Thus, I think the parameter parsing issue that this JIra issue encompasses does apply to me.
> ParameterParser bug - ordinal parameter mismatch
> -------------------------------------------------
>
> Key: HHH-1423
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.2
> Environment: Windows XP SP2, JDK 1.5.0_06-b05, Spring 1.2.6, antlr-2.7.6rc1
> Reporter: Artur Wronski
> Priority: Critical
> Attachments: HHH1423Test.java, ParameterParser.2.patch, ParameterParser.3.patch, ParameterParser.patch, RecognizerBug.java
>
>
> There is still problem with ParameterParser. The same was in Hibernate 3.1.1
> Runnable TestCase in attachment.
--
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
17 years, 3 months