[Hibernate-JIRA] Closed: (ANN-393) Documentation errors in Many-toMany Annotation explanation
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-393?page=all ]
Emmanuel Bernard closed ANN-393:
--------------------------------
> Documentation errors in Many-toMany Annotation explanation
> ----------------------------------------------------------
>
> Key: ANN-393
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-393
> Project: Hibernate Annotations
> Type: Bug
> Components: documentation
> Versions: 3.2.0.cr1
> Environment: N/A
> Reporter: Pedro Lopez
> Assignee: Emmanuel Bernard
> Priority: Minor
> Fix For: 3.2.0.cr2
>
>
> The section "2.2.5.3.3.2. Default values" in the Annotations Online Manual has errors when describing the default values for Many-to-Many relationships.
> 1. The first error is when the manual explains the details of the 1st example in this section. The example list 2 classes City and Store but the description makes references to Store and "Table" instead of City. Here is the actual paragraph: "A Store_Table is used as the join table. The Store_id column is a foreign key to the Store table. The implantedIn_id column is a foreign key to the City table".
> 2. The second error this section occurres when again the manual is trying to explain the second example in this section. The sample code show 2 classe Store and Customers but the explaination makes mention of the Store, Customer and "City", which doesn't appear in the example code at all. Here is the actual paragraph: "A Store_Customer is used as the join table. The stores_id column is a foreign key to the Store table. The customers_id column is a foreign key to the City table."
--
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, 5 months
[Hibernate-JIRA] Closed: (ANN-7) Document usage of @IndexColumn in one-to-many with indexed collection
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-7?page=all ]
Emmanuel Bernard closed ANN-7:
------------------------------
> Document usage of @IndexColumn in one-to-many with indexed collection
> ---------------------------------------------------------------------
>
> Key: ANN-7
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-7
> Project: Hibernate Annotations
> Type: Improvement
> Components: documentation
> Versions: 3.2.0.cr1
> Environment: Hibernate 3.0.5, Hibernate Annotations 3.0 beta2 preview, HSQL DB
> Reporter: Ronald Wildenberg
> Assignee: Emmanuel Bernard
> Priority: Minor
> Fix For: 3.2.0.cr2
>
>
> I have a mapping for a List that does not result in the index column of the database table to be filled.
> @Entity
> public class A {
> @OneToMany(mappedBy = "a")
> @Cascade(value = CascadeType.SAVE_UPDATE)
> @IndexColumn(name = "index", base = 0)
> public List<B> getBs() {
> return bs;
> }
> public void setBs(List<B> bs) {
> this.bs = bs;
> }
> }
> @Entity
> public class B {
>
> @ManyToOne(optional = false)
> @JoinColumn(name = "a_id")
> public A getA() {
> return a;
> }
> public void setA(A a) {
> this.a = a;
> }
> }
> Using this mapping, the 'index' column for table B is never filled if I add B objects to A and save them.
> The weird thing is, if I change the mapping for getBs to the following:
> @OneToMany
> @Cascade(value = CascadeType.SAVE_UPDATE)
> @IndexColumn(name = "index", base = 0)
> an association table is created with columns a_id, b_id, index. The only change I made is removing the mappedBy attribute. This association table is not necessary, since an index column can be added to table B.
--
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, 5 months
[Hibernate-JIRA] Closed: (HBX-575) Able to add meta information on the reveng.xml file (common configuration for all renerated classes)
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-575?page=all ]
Max Rydahl Andersen closed HBX-575:
-----------------------------------
Resolution: Fixed
svn now has support for the following:
<table-filter ...>
<meta attribute="class-description">bla blah</meta>
</table-filter>
<table ...>
<meta attribute="class-description">bla blah</meta>
<column ...>
<meta attribute="get-scope">protected</meta>
</column>
</table>
Note: there is no inheritance and if we add support for it it will disabled by default,
furthermore table specific meta overrides whatever table-filter provides.
> Able to add meta information on the reveng.xml file (common configuration for all renerated classes)
> ----------------------------------------------------------------------------------------------------
>
> Key: HBX-575
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-575
> Project: Hibernate Tools
> Type: Improvement
> Components: reverse-engineer
> Versions: 3.1beta4
> Reporter: David Leal
> Fix For: 3.2beta9
> Attachments: svn-patch2.txt
>
>
> Just to add the posibility to set some meta information common to all possible generated *.hbm files, for example to set that ALL generated file will implement toString method or equal/hash code.
> A good solution whoud be to add some filter options in order to speficy the set of Tables it would apply, using regular expresion, like include nestede target from ant. Something like this:
> <meta attribute name="theAttributeName" value="theValue">
> <include name="theListOfTableToInclude"/>
> <exlude name="theListOfTablesToExclude">
> </meta>
> If it is more complicated just to add the possibility to add meta information for all possible generated files.
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2102) problem when design tables to support multi languages
by mohammad norouzi (JIRA)
problem when design tables to support multi languages
-----------------------------------------------------
Key: HHH-2102
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2102
Project: Hibernate3
Type: Improvement
Environment: Apache Tomcat 5.5, MySql 4.1, Hibernate 3.1
Reporter: mohammad norouzi
Dear Hibernate Team,
We have faced a problem in our enterprise project and we think it could be resolved by Hibernate. the problem is that our project is supporting many languages, in fact, our database designed to support this feature. to enagae this feature we have two method to implementing the tables:
(in order to be clear I am using Employee table as an example)
1. break a table into two tables, one contains locale-independent and the other locale-dependent informations.
a table, say, "Employee":
Employee (id , birthdate, ssn, employment_type)
and locale-dependent table, say, EmployeeLocale
EmployeeLocale (id, locale_id, given_name, family,....)
2. another way is to seperate locale-dependent information in different tables:
Employee (id , birthdate, ssn, employment_type)
EmployeeEnglish (id, given_name, family,....)
EmployeeFrench (id, given_name, family,....)
EmployeeSpanish (id, given_name, family,....)
....
if information are very huge, maybe the second one has better performance.
any way, the problem comes out when designing the entities and/or value objects with Hibernate. according to first method, we have a Class Employee and a Class EmployeeLocale and they have one-to-many relationship with each other. this is not good when you are working with a big project. in order to access locale-dependent informations you shoud get the Employee and then get its collection, say, "employeeLocales" and in that collection there is only one record because you requested it ,for example, with French locale. in the other hand, when you want to persist some information you should initialize the collection and then insert an instance of EmployeeLocale class into it.
if you opt the second method, it has some other problem.
first off, you have to create a new entity class for every locale (or every table you create) and they have the same attributes and fields (data redundancy in designing entities not tables).
in addition, when insetrting, for example, a new Employee in french, you should use many "if then else" statements in your codes to check if it is french then instantiate EmployeeFrench and so on.
however, it will resolved using the design patterns. We are using some workaround to solve this problem, however, we had to get away some features of Spring framework like IoC. We have defined an Interface, say, Employee and an Abstract class, say, BaseEmployee that implements only locale-independent attributes and other classes that extends from that abstract class and contains locale-dependent info.
and finally, we used the Command Pattern to manage the DAO classes, so, our developers only know the Employee interface and an manager that returns appropriate DAO to interact with database, of course, passing an localeId is necessary here.
eventually, I think these are not good and the problem should be manipulated in Hibernate. I mean we should have only one Entity, say, Employee and it should be populated with requested locale in a moment, but Hibernate doesnt support these sort of things. I tried every features of Hibernate, from secondary tables to inheritance, but none of them work correctly.
As you are developing Hibernate, We wanted to know if you have any idea to get around the problem or if it will be a new feature in the next versions of hibernate to support this.
any suggestion or comment will be appreciated.
Thank you in advance and wish you success.
Regards
M.Norouzi
--
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, 5 months
How can I solve the problem?
by Tim Wu
Hi there,
The case is there is a immutable class A (table T_A) and it has a list of mutable class B (table T_B). When class A gets persisted, only the new or modified instances in the list of class B will be inserted or updated in T_B. T_A will not get affected.
Somehow, I need to use <union-subclass ....> to map a class A to a table T_A and use <bag ...> to map a list of class B in class A's mapping file. Because T_A is immutable. a custom peresister class is created that extends from UnionSubclassEntityPersister and its isMutable() method returns false. When Hibernate loads the class A, its status is set to READ_ONLY.
In the business processing, some new instances of class B are added to the list in the class A. However, when the session gets flushed, Hibernate will check the status of the class A in AbstractFlushingEventListener.prepareEntityFlushes (...). In this method, only the status of MANAGED or SAVING will get flushed. Class A will not get flush because its status is READ_ONLY. The new instances of class B in the list will not get inserted into table T_B.
What is the right solution to this case? How can I update or insert B into T_B only without affect A?
I will appreciate if you could help me.
Thanks,
Tim
18 years, 5 months