-->
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.  [ 3 posts ] 
Author Message
 Post subject: @GeneratedValue mixed with manual values
PostPosted: Fri Jun 16, 2006 4:10 am 
Newbie

Joined: Thu Jun 15, 2006 3:33 pm
Posts: 11
Location: Bristol, England
Hi,

I've a class with a constructor and method:
Code:
    public TableDefn(String internalTableName) {
        if (internalTableName == null) {
            this.internalTableName = (new RandomString()).toString();
        } else {
            this.internalTableName = internalTableName;
        }
    }

    public String getInternalTableName() {
        return this.internalTableName;
    }


If you supply an internalTableName to the constructor, it uses that as the object's ID, otherwise it generates one itself.

I'm new to hibernate and want to use annotations to mark up my objects. The question is, could you use @GeneratedValue as follows, or would it be best not to?
Code:
    public TableDefn(String internalTableName) {
        if (internalTableName != null) {
            this.internalTableName = internalTableName;
        }
    }

    @Id
    @GeneratedValue
    public String getInternalTableName() {
        return this.internalTableName;
    }


i.e. to have hibernate generate a value if you don't specify one, rather than the code.

I know this would be a bad idea if using sequences in an SQL database directly - it may be possible for the db to generate a value that already exists for example. In hibernate, is this any different?

Regards,

Oliver[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 16, 2006 7:40 pm 
Newbie

Joined: Thu Jun 15, 2006 3:33 pm
Posts: 11
Location: Bristol, England
Having read a bit more of the manual, I see it is a bad idea - never mind.

Oliver


Top
 Profile  
 
 Post subject: About Hibernate and Oracle VPD
PostPosted: Fri Mar 07, 2008 6:56 am 
Beginner
Beginner

Joined: Mon Oct 01, 2007 8:21 am
Posts: 40
Hi,

I just want to implement Oracle VPD features in my application, how would i be able to make a connection from hibernate.

My Reference site are :

1. http://www.adp-gmbh.ch/ora/security/vpd/index.html

2. http://javazone.org/howto/hibernate-with-oracle-vpd

I am using Jboss server, as discussed in this forum to make a connection

Some configuration done in the weblogic server it seems, could some one explain me how this is done.

Is there is any other refernce document to go through and get some idea regarding.

Thanks,
Ambika.


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