-->
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.  [ 9 posts ] 
Author Message
 Post subject: lazy in annotations from xml
PostPosted: Tue Aug 12, 2008 6:57 am 
Newbie

Joined: Tue Aug 12, 2008 6:49 am
Posts: 5
Hello, in my xml i have:
<class table="ADDRESS" lazy="false" name="xxx.dao.impl.Address">
what should I do in annotations to have lazy=false?
I cannot specify this in @Table, and the documentation says nothing.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 12, 2008 12:04 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

have a look at @org.hibernate.annotations.Proxy. With this annotation you can define the laziness attributes of the entity.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 13, 2008 1:38 am 
Newbie

Joined: Thu Jul 17, 2008 2:00 am
Posts: 4
Location: INDIA
You can use the following :-

@org.hibernate.annotations.Proxy(lazy = false)

hardy.ferentschik wrote:
Hi,

have a look at @org.hibernate.annotations.Proxy. With this annotation you can define the laziness attributes of the entity.

--Hardy
[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 13, 2008 2:42 am 
Newbie

Joined: Tue Aug 12, 2008 6:49 am
Posts: 5
thanks for your help!
hmm, so there's nothing in javax.persistance to do the same thing?
but i guess it's ok to mix hibernate and persistance annotations...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 13, 2008 7:25 am 
Newbie

Joined: Tue Aug 12, 2008 6:49 am
Posts: 5
and is it ok to substitute:
<property name="updatedDate" type="java.sql.Timestamp" access="field">
with
@org.hibernate.annotations.Type(type = "java.sql.Timestamp") ??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 13, 2008 7:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Yes, that should work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 3:40 am 
Newbie

Joined: Tue Aug 12, 2008 6:49 am
Posts: 5
again i dont' know what to do with these:

1. <many-to-one fetch="join" outer-join="true" column="CHANNEL" access="field" name="channel" insert="false" update="false"/>
@ManyToOne
@JoinColumn(insertable=false, updatable=false, name="CHANNEL")
but what about fetch="join" outer-join="true" ??

2. <column name="QUANTITY" sql-type="NUMBER(5)" not-null="false"/>
@Column(nullable = true)
sql-type ??

3.
<composite-id unsaved-value="none" access="field" name="pk">
<key-property column="PAME_ID" access="field" name="pameId"/>
<key-property column="SERVICE_ID" access="field" name="serviceId"/>
</composite-id>
composite keys ???

it would be nice to have some kind of a guide to transform xml into annotations...
thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 10:14 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
sunr wrote:
again i dont' know what to do with these:

1. <many-to-one fetch="join" outer-join="true" column="CHANNEL" access="field" name="channel" insert="false" update="false"/>
@ManyToOne
@JoinColumn(insertable=false, updatable=false, name="CHANNEL")
but what about fetch="join" outer-join="true" ??

@Fetch

sunr wrote:
2. <column name="QUANTITY" sql-type="NUMBER(5)" not-null="false"/>
@Column(nullable = true)
sql-type ??

@Type

sunr wrote:
3.
<composite-id unsaved-value="none" access="field" name="pk">
<key-property column="PAME_ID" access="field" name="pameId"/>
<key-property column="SERVICE_ID" access="field" name="serviceId"/>
</composite-id>
composite keys ???

@Embeddable, @EmbeddedId or @IdClass depending on which strategy you choose.

sunr wrote:
it would be nice to have some kind of a guide to transform xml into annotations...
thank you

All the information is in the online doc. I recommend reading the whole document instead of trying to find things as you go. If you need more detailed information I recommend getting "Java Persistence with Hibernate" (see link at top of page). There are tons of examples in the book often with xml and annotation mapping just next to each other.

Good luck :)

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 15, 2008 2:24 am 
Newbie

Joined: Tue Aug 12, 2008 6:49 am
Posts: 5
thank you for helping me!
I will read the manual more carefully.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.