-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to do Hibernate Versioning Using Annotaions
PostPosted: Wed Oct 07, 2009 1:26 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 2:30 am
Posts: 47
I want to do Hibernate versioning using annotions, but i cannot find resources to do it.
Please help me to go through this....

regards,
Dil.


Top
 Profile  
 
 Post subject: Re: How to do Hibernate Versioning Using Annotaions
PostPosted: Wed Oct 07, 2009 4:57 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
I think you might be after something like JBoss Envers, althought I believe it's a part of Hibernate Core. I would verify.


Top
 Profile  
 
 Post subject: Re: How to do Hibernate Versioning Using Annotaions
PostPosted: Wed Oct 07, 2009 5:13 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 2:30 am
Posts: 47
I just want to know how to do this...

I have entity class and I added version attribute for represent tables 'version' field like this..

Code:
    private int version;

    @Version
    @Column(name="VERSION", nullable=true, length=10)
    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }


I have table field named 'VERSION' in my oracle database. its type is number and default value is 0.

The problem is this doesn't work. Should I do anything else apart from this ?


Top
 Profile  
 
 Post subject: Re: How to do Hibernate Versioning Using Annotaions
PostPosted: Sun Oct 11, 2009 7:11 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
The problem is this doesn't work.

What are you expecting, and what happens instead?

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: How to do Hibernate Versioning Using Annotaions
PostPosted: Mon Oct 12, 2009 2:32 am 
Newbie

Joined: Fri Oct 09, 2009 5:01 am
Posts: 2
Hi

I dont see any problem , i think it should work.

Example :

@Column(name = "OptLockVersion")
@Version
private int m_version;

public int getOptLockVersion() {
return m_version;
}

Generally Attributes nullable=true, length=10 for your version @Column, i think should not be there.


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