-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Duplicated columns in gen. sql(superfluous data transfer)
PostPosted: Tue Oct 14, 2008 5:33 am 
Newbie

Joined: Thu Aug 30, 2007 5:07 am
Posts: 5
The only fix for that I found was using the component instead of entity. But the performance of using components is worse for some reason. So that's not the way to go.

Hibernate version:
3.3.1

Mapping documents:
@Entity
@org.hibernate.annotations.Entity(mutable = false)
@Table(name = "demo_tmp_fin_header")
public class TmpFinHeader {
@Id
@Column(name = "edw_doc_id")
private String edwDocId;

@Column(name = "period")
private Date period;

@OneToMany
@JoinColumn(name = "edw_doc_id")
@org.hibernate.annotations.BatchSize(size = 100)
private Set<TmpFinData> tmpFinDataSet = new HashSet<TmpFinData>();

// getters, setters
}

@Entity
@org.hibernate.annotations.Entity(mutable = false)
@Table(name = "demo_tmp_fin_data")
public class TmpFinData {
@EmbeddedId
private TmpFinDataId tmpFinDataId;

@Column(name = "amount")
private BigDecimal amount;

// getters, setters
}

@Embeddable
public class TmpFinDataId implements Serializable {
@Column(name = "edw_doc_id")
private String edwDocId;

@Column(name = "amount_id")
private String amountId;

// getters, setters, equals, hashCode
}

Code between sessionFactory.openSession() and session.close():
TmpFinHeader header = hibernateTemplate.get(TmpFinHeader.class, 1);
header.getTmpFinDataSet().size();

Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):
select
tmpfindata0_.edw_doc_id as edw2_1_,
tmpfindata0_.amount_id as amount1_1_,
tmpfindata0_.amount_id as amount1_1_0_,
tmpfindata0_.edw_doc_id as edw2_1_0_,
tmpfindata0_.amount as amount1_0_
from
gl_loan.demo_tmp_fin_data tmpfindata0_
where
tmpfindata0_.edw_doc_id=?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2008 9:20 am 
Newbie

Joined: Thu Aug 30, 2007 5:07 am
Posts: 5
Please, tell at least if this is a bug? Should I create a Jira bug for that?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.