How can you add autonumber feature in an entity class?

Hi guys!
Can you pls help me with this problem, I'm new to java EE. I've got an entity class and I want to implement an auto number feature using the following code:
{ *{color:#ff0000}private static final long serialVersionUID = 1L;*
*{color}* *{color:#ff0000}@Id*
* @GeneratedValue(strategy=GenerationType.AUTO)*
*{color}* @Basic(optional = false)
@Column(name = "CUST_ID")
private Long custId;
But this doesn't work, it gives me the following error: "java.sql.SQLSyntaxErrorException: Table/View 'SEQUENCE' does not exist.". Can you also briefly explain to me how the database will accept this with configuration(if it will accept).

GenerationType.AUTO:
Indicates that the persistence provider should pick an appropriate strategy for the particular database. The AUTO generation strategy may expect a database resource to exist, or it may attempt to create one. A vendor may provide documentation on how to create such resources in the event that it does not support schema generation or cannot create the schema resource at runtime.
http://java.sun.com/javaee/5/docs/api/
I use Hibernate as a provider and Oracle as ad DB and had to create a seuence called HIBERNATE_SEQUENCE
m

Similar Messages

  • How can you add a where clause using "OR" with applied ViewCriteria?

    [JDeveloper 10.1.3 SU4]
    [JHeadstart 10.1.3 build 78]
    I am using JHeadstart, but have a question probably more in the ADF area. On the JHeadstart forum I asked:
    "I am overriding JhsApplicationModule's advancedSearch in order to be able to search in childtables. I created transient attributes, display those in advanced search and in the overridden method I check if any of these are filled by the user and create a where clause like 'EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>)'. I add this whereclause using ViewObject.setWhereClause.
    So far so good and it works. However, if the user selects 'Result matches any criteria', combining setWhereClause and the normal advancedSearch QueryByExample implementation using ViewCriteriaRow do not provide the desired result, since the ViewCriteria and the setWhereClause are AND-ed together, which is fine if the user selects the (default) "Results match all criteria" (everything is AND-ed) but not the "Result matches any criteria", since then every criterium is OR-ed together, except for the setwhereclause criteria and the set of ViewCriteriaRows, they are AND-ed.
    I looked if I could specify that a WhereClause will be OR-ed to existing applied ViewCriteria, but no luck. Do I have to rewrite also advancedSearch's ViewCriteria implementation and write an entire setWhereClause implementation to be able to "OR" every criterium? Or any other suggestions? Can I look at the entire Where clause and rewrite it (after applyCriteria and setWhereClause are called on the VO)?
    Toine"
    Sandra Muller (JHeadstart Team) told me today: "This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. The question is: how can you add a where clause using "OR" if there are already one or more ViewCriteria applied?
    To simplify the test case, you could create a simple ADF BC test client class in a test Model project without JHeadstart (in the test class, use bc4jclient + Ctrl-Enter), in which you first apply a few ViewCriteriaRows to a View Object and also add a where clause.
    Can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? (This what I am doing now ;-))
    Thanks,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?
    Toine

    Hi,
    Can you SET your whereclause as follows ?
    ('Y' = <isAnd>
    and EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>))
    OR ('N' = <isAnd>
    AND EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> OR <another column in childtable> LIKE '<value supplied by user>))
    )

  • I have an ipod touch and the contacts icon is missing.  How can you add it to the home screen?

    I can't find the contacts icon... How can you add this to the home screen

    Every iPod touch has a contacts icon. It might be hiding. You can try Settings > General > Reset > Reset Home Screen Layout.

  • How can you add an image in Mail without being an attachment?

    How can you add an image in Mail without being an attachment?
    In otherwords I'd like to put my logo in the email not as an attachment but as an image.
    Is there a simpel solution to this problem?

    PBN1 wrote:
    How can you add an image in Mail without being an attachment?
    You don't.
    It's not possible. The e-mail protocol is designed for text; anything else has to go as an attachment.
    Different mail clients (such as Mail.app, the mail client bundled with Mac OS X) may have different ways of handling such attachments, but they are still attachments. Each mail client has its own rules and methods, so one may display a picture as if it were in the body of the message, but another client may do something completely different.
    A way of faking it is to format your message in HTML (which is a kind of text). The image is hosted on a remote server, not added to the message; instead, you include a link to it in the body of the message, as you would when building a web page. (This is also what the two tips helpfully provided by X423424X do, except that the link to the image is added in the signature, rather than the body of the message.) What exactly happens to it is, again, at the discretion of the mail client. In my case, for instance, displaying images in HTML messages is turned off, and will stay resolutely off.

  • HT5622 how can you add a group to contacts to email or message?

    How can you add a group to your contacts to email or message a group?

    There are example OMB commands in the MDL referenced in the post below;
    http://blogs.oracle.com/warehousebuilder/newsItems/viewFullItem$198
    Look at the body of the expert you will see examples of creating joiners, filters, aggregators, constants etc all via OMB.
    Cheers
    David

  • HT5649 how can you add a previous playlist from a different apple Id  both belong to the same person

    how can you add a previous playlist form a different apple ID, both belong to the same person

    It's ok to share the same AppleID for iTunes.  Use Separate ID's for iCloud, iMessage, and Facetime. 

  • How can you add a 2nd i Tunes account on the same computer?

    How can you add a 2nd i Tunes account to the same computer?

    I had an application where I spawned (= ran with Start Asynchronous Call) multiple (reentrant) copies of VIs, and would occasionally "lose control" of them.  I needed a way to find all VIs that were running "Top Level" and stop them (so I didn't have to log off from Windows).
    I used the Application Property "All VIs in Memory" to get an array of (wait for it ...) All VIs in Memory.  I took each name, opened a VI reference to it (simply wire the name string in, as the VI is, by definition, "in memory"), looked at its VI Execution State, and if it was Run Top Level, Invoked the FP.Close and Abort VI Methods.  [To prevent the VI that did all this from "committing Suicide", I compared the name string with the current Call Chain, and did nothing if there was a match].
    I think you could adopt this idea to do what you need.
    BS

  • HT201320 How can you add an email address in your email box in an ipad

    How can you add your e-mail address in you iPad mail box?
    Rita

    Go to settings.app -> mail, contacts, calendars-> click "add account"
    Hope this helped

  • How can i add custom attributes to a new Class Object using the API ?

    Hello everyone,
    Here is my problem. I just created a subclass of Document using the API (not XML), by creating a ClassObjectDefinition and a ClassObject. Here is the code :
    // doc is an instance of Document
    ClassObject co = doc.getClassObject();
    ClassObjectDefinition cod = new ClassObjectDefinition(ifsSession);
    cod.setSuperclass(co);
    cod.setSuperclassName(co.getName());
    cod.setName("MYDocument");
    ClassObject c = (ClassObject)ifsSession.createSchemaObject(cod);
    Everything seems to be OK since i can see the new class when i use ifsmgr. But my question is : how can i add custom attributes to this new class ? Here is what i tried :
    AttributeDefinition value = new AttributeDefinition(ifsSession);
    value.setAttribute("FOO", AttributeValue.newAttributeValue("bar"));
    c.addAttribute(value);
    But i got the following error message :
    oracle.ifs.common.IfsException: IFS-30002: Unable to create new LibraryObject
    java.sql.SQLException: ORA-01400: impossible d'insirer NULL dans ("IFSSYS"."ODM_ATTRIBUTE"."DATATYPE")
    oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewSchemaObject(oracle.ifs.server.S_LibraryObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.NewSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.createSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    void fr.sword.ifs.GestionDocument.IFSDocument.createDocument(java.lang.String)
    void fr.sword.ifs.GestionDocument.IFSDocument.main(java.lang.String[])
    So, what am i doing wrong ?
    More generally, are we restricted in the types of the attributes ? (for example, would it be possible to add an attribute that would be an inputStream ? Or an object that i have already created ?).
    Any help would be appreciated. Thanks in advance.
    Guillaume
    PS : i'm using Oracle iFS 1.1.9 on NT4 SP6 and Oracle 8.1.7
    null

    Hi Guillaume,
    you're welcome. Don't know exactly, but assume that ATTRIBUTEDATATYPE_UNKNOWN
    is used to check for erronous cases only
    and it shouldn't be used otherwise.
    Creating your own objects could be simply done via
    ClassObject ifsClassObject;
    DocumentDefinition ifsDocDef = new DocumentDefinition(ifsSession);
    // get class object for my very own document
    ifsClassObject = ClassObject.getClassObjectFromLabel(ifsSession, "MYDOCUMENT");
    // set the class for the document i'd like to create
    ifsDocDef.setClassObject(ifsClassObject);
    // set attributes and content for the document...
    ifsDocDef.setAttribute("MYFOO_ATTRIBUTE",....);
    ifsDocDef.setContent("This is the content of my document");
    // create the document...
    PublicObject doc = ifsSession.createPublicObject(ifsDocDef);
    null

  • HT5012 How can you add a self signed CA Certificate to iOS 8?

    How Can I add a self signed CA Certificate to an iPad with iOS 8.1?

    I don’t think that I can help you but I am very interested in your question. Perhaps you have seen information about a related problem…
    https://discussions.apple.com/thread/6590335
    One way to install the self-signed CA certificate is to export it to a .CER file, email it to the iOS 8 device, open the attachment and process it. My guess is that the certificate will be installed (check the resulting profile) but due to an iOS 8 bug it will be ineffective.
    Or, you could send a signed email from the email account for the CA. Open the email on the iOS 8 device and process it.
    I assume your goal is for certificates issued by the CA to be automatically trusted on the iOS 8 device. Good luck with that.
    The method I used was to send a .CER file. The CA certificate showed up as a profile. However, I do not get automatic trusting of certificates issued by the CA.

  • How can you add images and text to UIScrollBar Component

    I can only add the text, can't add images. Also how can you make paragraphs out of long text in a UIScrollBar?
    Thanks.

    Hi,
    UIScrollBar Component can be attached to a dynamic text filed and the text field can be set to Render Text as HTML option which in turn can display both text & images(using <img> tags).
    Refer http://www.flashvalley.com/fv_tutorials/loading_HTML_in_a_dynamic_text_field/page2.php that may help you getting what do you want
    Thanks!

  • How can you "Add document" in shared documents without allowing editing the page ie Contribute?

    Hello Community
        Using SharePoint 2010 Server and the UI, when you click "Site
    Actions" - "New Site" and you create Team Site that that is a
    Sub-site. 
        When you create the Visitor, Members and Owners groups
    how can you allow the user to add a document while at the same
    time not allow them to edit the page when adding the document
    as the only permissions are Full Control, Contribute and Read?
        Thank you
        Shabeaut

    Hi Shabeaut,
    To create a new permission level, you should manage the Parent (site collection).
    Your current location is subsite, and it looks like it has unique permission(broke inheritance) that is the reason you are not able to see the create permission level. and another reason for seeing Inherit Permissions along with other menus in the ribbon.
    You should also see Manage Parent along with the menus you see when your site inherits permission from parent.
    So, go to your site collection and create a new permission level and assign users to it.
    And to assign permission level to your new groups, you will be able assign permission when you create a new group, along with the name, all permissions would be listed in the same page(_layouts/newgrp.aspx).
    see the below screenshot for more info -
    ->Site Actions menu-> Site Settings->Users and Permissions->Site ->Permission Levels.
    Hope this helps!
    MCITP: SharePoint 2010 Administrator
    MCTS - MOSS 2007 Configuring, .NET 2.0
    | SharePoint Architect | Evangelist |
    http://www.sharepointdeveloper.in/
    http://ramakrishnaraja.blogspot.com/

  • How can you add/change the currency rate in spro?

    Hi all,
    you can add a new currency code by going to spro --- general settings --- check currency codes
    for example: PERU ---> PEN
    But, how can we add/change the currency rate PEN in spro?
    for example: Peruvian Nuevo Sol     = 4,3567619
    Is it still in customizing? And if so, where can i find it?
    Many thanks in advance.
    Kind regards,
    Pamela.

    Hi Aman,
    I have entered the field to add the new currency rate.
    But the system doesn't want to valid my new rate.
    I get the following error message:
    "Input should be in the form ._,____ "
    Do you know how to override that command?
    Thanks.
    Regards,
    Pamela

  • HT201365 how can you disable this feature?Don't want to have to use passcode everytime i need to use the devise.

    How can you disable the password feature? Don't want to have to use code every time I need to use the phone.

    goto settings->general->passcode lock->turn passcode off

  • How can you add optional audio to a converted ppt deck?

    Our group is working on a project based on a powerpoint deck synchronized with audio .wav files (and converted to an .swf file). The deck is an interactive training module with a voiceover. We want to maintain the association of particular slides in the sequence with particular wav files, but we want it silent by default. How can we make it so that the voiceover audio is silent by default, but have a "play now" button embedded in the deck?
    Any advice would be welcome!
    Christina Leshko
    Rutgers University

    There are a couple of ways you could do this:
    Add a button labelled 'Play Now' to the very beginning of your slide and set the button's pause point so that it pauses your slide before the audio begins to play.  The button action would be to simply Continue.  So when the user reaches this slide, they can inspect the graphics or text on the slide for as long as they like and then click the Play Now button to listen to the audio for that slide.
    Do not have your audio connected to the slide but to the Success caption of a Play Now button.  The button pauses the slide but the audio will only play when the user clicks the button and the Success caption would have appeared.  If you do not want the Success caption to be visible, make it a transparent caption with no text.  It will be present on stage while the audio is playing but not visible to the user.

Maybe you are looking for