[Hibernate-JIRA] Resolved: (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 resolved ANN-7:
--------------------------------
Resolution: Fixed
example added to the doc
> 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
19 years, 6 months
[Hibernate-JIRA] Resolved: (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 resolved ANN-393:
----------------------------------
Resolution: Fixed
Assign To: Emmanuel Bernard
> 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
19 years, 6 months
[Hibernate-JIRA] Commenté: (HHH-1739) HILO id can cause deadlock: Part deux
by Xavier Brénuchon (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1739?page=c... ]
Xavier Brénuchon commented on HHH-1739:
---------------------------------------
Hi Martin, it's not the problem of this case (but for HHH-1669).
For this case we need to have a 2nd Local DataSource for Id generation only.
> HILO id can cause deadlock: Part deux
> -------------------------------------
>
> Key: HHH-1739
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1739
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.3
> Environment: Hibernate 3.1.3 running JDK 1.4.1_07 Solaris 5.8
> Adaptive Server Enterprise/12.5.2/EBF 12054 ESD#2/P/Sun_svr4/OS 5.8/ase1252/1844/64-bit/FBO/Thu Aug 12 10:51:11 2004
> Reporter: Kirk Rasmussen
>
> Original Estimate: 1 minute
> Remaining: 1 minute
>
> This is mostly a duplicate of HB-1246 but with a twist. I believe that there is a flaw in Hibernate's design for how it generates ids for some dialects. This is a particular problem for deep object graphs and/or at high volume. Or at least it is a problem for those of us stuck on the crappy Sybase platform.
> We have an application that creates hundreds of objects that need ids generated within a single transaction. It is quite common for us to potentially exhaust the connection pool with a deep object graph. We are persisting a Trade object which has a complex and deep object graph (upwards of 100s of persistent objects). Within each trade there are roughly 15 classes which need generated ids with 30 or more instances of each class in some cases.
> IMO The design flaw is when the ids are generated. From quickly browsing the source it seems that they are being generated on the fly as the objects are being processed. This can result in running of out database connections when under load or when a particular trade has a large number of persistent object instances and deadlocking the system.
> A better design would be if the ids could be generated for all tables in a single transaction up front rather than issuing a whole bunch of individual transactions for each table and object.
> I believe that TOPLink generates all its ids up front to avoid the described resource thrashing. It also has the configuration to generate ids from within the same transaction as the original unit of work or from a secondary unit of work.
> See org.hibernate.id.MultipleHiLoPerTableGenerator
--
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
19 years, 6 months
[Hibernate-JIRA] Created: (HHH-2101) Can't use outer join in table with composite-id, key-many-to-one
by Hugo Zhu (JIRA)
Can't use outer join in table with composite-id, key-many-to-one
----------------------------------------------------------------
Key: HHH-2101
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2101
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.1.3
Environment: MYSQL: 5.0.15-nt-log
mysql-connector-java-3.0.16-ga
Hibernate 3.1.3
Reporter: Hugo Zhu
MYSQL 5 database;
HBM like below:
<class name="Blog" table="blog" dynamic-update="true">
<id column="id" name="id" type="long">
<generator class="native"/>
</id>
...
</class>
<class name="BlogUrl" table="blog_url" dynamic-update="true">
<id column="id" name="id" type="long">
<generator class="native"/>
</id>
<property name="url" type="string" length="255" not-null="true"/>
<property name="urlHash" type="string" length="32" unique="true" not-null="true"/>
<property name="numOfHits" type="integer"/>
<property name="created" type="timestamp"/>
</class>
<class name="BlogUserUrl" table="blog_user_url" dynamic-update="true">
<composite-id>
<key-many-to-one name="url" class="BlogUrl"/>
<key-many-to-one name="blog" class="Blog"/>
</composite-id>
<property name="title" type="string" length="255" not-null="true"/>
<property name="description" type="string" length="255"/>
<property name="created" type="timestamp"/>
</class>
But:
getSession().createCriteria(BlogUserUrl.class).setFetchMode("url",FetchMode.JOIN).add(Restrictions.eq("blog", blog).setMaxResults(25).list();
Still generates 2 queries - query 1: query out BlogUserUrl, then query 2: possible 25 sub queries for earch BlogUrl
The better way should be just 1 outer join.
I have set: <property name="max_fetch_depth">1</property> in Hibernate configuration, but there is no join attribute in element: key-many-to-one.
The only way to solve this issue I can find out is:
HQL: select this,this.url from BlogUserUrl this where this.blog=?, but I have to add a loop in results to conver the Object[] list to BlogUserUrl only list. Not ideal
Thanks for looking into this issue.
Hugo
--
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
19 years, 6 months