Ejb3 entity bean not generating valid sql for postgres 8.1

Hello,
I originally posted this on the jboss seam board as I ran across this error on a seam test example, but it seems it's more generally applicable to ejb3 entity beans not generating sql that postgres can understand. I'll post my message below, all replies are appreciated.
I'm going through the hello world example from the seam book, and I'm getting an error I cannot resolve, that with an auto generated sql statement, that's not valid for postgres 8.1, the database I'm on. Here's my error:
17:40:31,370 INFO [STDOUT] Hibernate: select next value for person_id_seq from dual_person_id_seq
17:40:31,394 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42601
17:40:31,394 ERROR [JDBCExceptionReporter] ERROR: syntax error at or near "value"
17:40:31,396 FATAL [application] javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get next sequence value
javax.faces.el.EvaluationException: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get next sequence value
Here's the table definition
- create table Person (id bigint not null, name varchar(255), primary key (id))
- create table dual_person_id_seq (zero integer)
- create sequence person_id_seq start with 1 increment by 1
and here's the entity bean:
@Entity
@Name("person")
@Table(name="person")
@SequenceGenerator(name="person_sequence", sequenceName="person_id_seq")
public class Person implements Serializable {
private long id;
private String name;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="person_sequence")
public long getId() { return id;}
public void setId(long id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
How do I get it to generate a valid sql statement for postgres?

I think you should try putting the sequence generator annotation over the primary key field. Try it and be sure it works.
regards,
Michael

Similar Messages

  • EJB3 entity bean update, best practice

    I have an ejb3 entity bean that models a time that can be reserved in a booking system.
    I need a way to reserve the time for a specific user. Ofcourse the reservation should not overwrite if the time has already been reserved by another user.
    What is the best/cleaneste way to provide this service?
    I have thought of the following ways.
    I could put a version field on the entity. When the user is set in the frontend the entitybean will check that the time is not already reserved. If not it will be sent backup to the stateless session bean for persisting. If the time has been reserved by another user in the meantime JPA will throw an exception since the version doesn't match any more. The frontend can then show the error to the user.
    I could make the frontend call a method in a stateless session bean to reserve the time. The function could take the times primary id and the users primary id and loaded them from persistence. Then check if the time is already reserver else set the user and persist the time again. This should ofcourse be within a transaction and possibly also use a version attribute on the entity.

    Only fields detected as persistent-dirty will be updated in the database record.
    Laurent

  • How to Force JHS do not generate navigation cases for Groups?

    Hello
    I have already seen "Overwrite faces-config and navigation rules " property for Group in JhsApp deff .But It does not work .How Force JHS do not generate navigation cases for Groups? and another question is that how can I customize navigation case generation in JheadStart?
    Thanks

    Hi,
    You are right: the navigation rules in the main faces-config file are overwritten, even if you uncheck these flags. Here is the solution:
    If you want to preserve some of the navigation rules in the main faces config: alter the velocity template for faces-config. You can only switch off the entire generation of faces-config.xml; not individual parts.
    If you want to add a special navigation rule: add it to the group faces config file.
    If you want to preserve post-generation changes to the group faces config file: uncheck 'generate controller group?' or put it in the templates for that group.
    Note: the flag 'Overwrite Faces-Config beans and Navigation Rules?' has become obsolete, you should only use 'Generate Controller Group?'.
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team

  • BI-IP: 0REQPLAN is not a valid characteristic for Infoprovider

    Hi All,
    We are on BW 7.0 EHP 1, SP 9, and when we are trying to create a planning filter on an agg level, we re getting the following error:
    0REQPLAN is not a valid characteristic for Infoprovider.
    Program error in class SAPMSSY1 method: UNCAUGHT_EXCEPTION.
    Could not read InfoProvider ZCUBE_C01.
    Could not create filter
    Any idea?
    Thanks in Advance,
    Best Regards,
    - Shashi

    Hi All,
    Installing 0REQPLAN from the Business Content solved the issue.
    Thanks & Best Regards,
    - Shashi

  • "not a valid location for linked resource" in Flash Builder 4.7

    Hi,
    I'm constantly running into the problem, that Flash Builder simply won't let one create a linked resource that points to a location on the same drive?
    I'm getting the infamous
    "...not a valid location for linked resource..."
    error message.
    I'm using FB 4.7 with Flash Professional CC.
    Is that supposed to work at all?
    I've 1 workspace where I've successfully created a linked resouce - but it fails for all others. Even when I'm setting up a new WS.
    And it's totally unclear to me why it had worked there but not in all others that I'm trying to create.
    André

    A year later, but I'm facing the same bug.
    If your ever found a solution I'd be glad to hear.
    I filed a bug with more details and my own workaround: 
      3697022

  • F110 payment run completed but not generated all check for the payments

    Do any one have an idea or the potential answer on my query
    I've run F110 and generated one Payment all 45 open items for one vendor
    Now after the print done only the first 20 items got into the check register, and left over the remaining 25 items
    So my question is why system not generated the check for the remaining 25 items and what is the remedy

    No all settings are available, but still the same situation the all checks are not generated for all items of the vendor open items clearing in the one payment documents
    single vendor
    single payment for all 25 open items
    After print activity compelted
    checks created for items 5
    leftover items 20 not created check
    can anyone tell why system is behaving like this

  • Fi Document is not generating in MIGO for multiple account assignment in PO

    Hi,
    I have have created  asset po DG set 111 quanity is 4, i have created 4 different assets and assign quanity 1 to each dg sets in account assignment. While doing GRN system is not generating FI document for this po. if  i am giving one quanity or single account assignment for as 4 then it is generating FI quantity.
    PLease help me out why system is not generating FI document for multiple accont assignment in MIGO.
    Thanks in advance
    KISHORE

    Hi
    There is no option if you are not on EhP4... Do MIRO and see if the FI doc is generated
    Only way is to do MIRO immediately after MIGO.. OR Schedule ERS (Evaluated Receipt Settlement) which runs every hour in the background so that MIRO is posted automatically based on MIGO document.... Basically, you have to do MIRO after MIGO.. Whether you do it manually or through ERS is a matter of choice
    Regards
    Ajay M

  • Call Function not Generating Function Module for Smartform

    Hi Gurus,
    We have a work copy print program use to print deliveries (smartforms). This program works fine in Production but right now we are doing some testing and I found out that when we run this program in QUALITY environtment, it shortdumps with error saying "Function Module Not Found"
    Basically when it gets to the Function Module "SSF_FUNCTION_MODULE_NAME", it could not generate any function module for the form it Sy-Subrc = 2 Exception meaning NO_FUNCTION_MODULE.
    The problem is this only happens in our QUALITY environment.I compare the function module in the 2 systems, there was not diff as this is a Standard SAP module. I passed diff smartforms we have in QUALITY through the FM and it will not generating any FM for any of them. So this is not an error from the smartforms, bcos all the same smartforms generates FM in Prod.
    So what I did next is to Debug the FM "SSF_FUNCTION_MODULE_NAME" in the 2 systems to see where the diff is coming from. I noticed 2 views that the FM is using, they are STXFADM and D010SINF . So on the Production system, STXFADM-LASTDATE and D010SINF-UDAT fields are the same value, so it generates the FM. On the QUALITY systems, the values are different hence it skips the code to generate the FM.
    Thanks Guys.
    Points will greatly be awarded for this.

    Please guys, help me look into this, I really need a solution fast.
    Thanks

  • IProcurement is not a valid responsibility for the current user. Please contact your System Administrator.

    Hi All,
    When I am trying to click on the 'iprocurement Home page' menu in the iprocurement responsibility getting the below error message in R12;
    "iProcurement is not a valid responsibility for the current user. Please contact your System Administrator."
    Can any one let me know how to resolve this?
    Regards
    Joseph

    Hi Joseph,
    I am assuming that the user actually has the iProcurement responsibility assigned to them. If so, try the following solution from note 1560400.1:
    1) Logon with System Administrator responsibility
    2) Navigate to Profile > System, click on User and enter the user name
    3) Search for profile 'Applications Start Page'. Delete the value set at user level and save
    4) Retry
    Regards,
    Cheryl

  • Will updates to an EJB3 entity bean update ONLY changed columns?

    Hello,
    If you have an EJB3 entity bean that maps to a table, and then you change the value of ONE of the fields in the entity bean, will each column in the row be updated, OR just the column that changed in the row?
    Thanks

    Only fields detected as persistent-dirty will be updated in the database record.
    Laurent

  • Could not generate stub objects for web service invocation in ColdFusion

    I was able to call the services on the development box - windows server without any problem at all, everything was working fine but the moment i uploaded to a linux box production server I get this error. "Could not generate stub objects for web service invocation in ColdFusion"
    What could be the cause of this problem, i have googled a lot but no solution yet any ideas.

    Let me make it simple:
    1. Server A is our development server.- hosted inhouse with coldfusion installed.
    2. Server B is our production server - a linux server with coldfusion installed hosted on the internet
    3. Server C is a third party server containing the webservice - this is a windows server with .net
    coldfusion is installed on Server A, the code works here and can connect to server C without any problem. It gets the required respone
    but when the code was uploaded to server c it gives the error when we run it.
    now i tried just a simple code which works fine on server A below:
    <cfinvoke webservice="http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" method="ConversionRate" returnvariable="ConversionRateResult">
        <cfinvokeargument name="FromCurrency" value="EUR" />
        <cfinvokeargument name="ToCurrency" value="USD" />
    </cfinvoke>
    <cfdump var="#ConversionRateResult#" />
    But when i uploaded it to server C: it returns the error
    Cannot generate stub objects for web service invocation.
    Name: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. WSDL: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory) It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors.
    The error occurred in /home/works/public_html/currency.cfm: line 7
    5 :     <cfinvokeargument name="FromCurrency" value="EUR" />
    6 :
    7 :     <cfinvokeargument name="ToCurrency" value="USD" />
    8 :
    9 : </cfinvoke>
    Now if you try the preceeding code on a windows environment  it works fine but the moment you put in the in the linux environment it generates this error
    I feel that the error may actually be :
    java.io.FileNotFoundException: /opt/coldfusion8/stubs/WS728929035/NET/webserviceX/www/Currency.java (No such file or directory)
    but i am clueless as to what to do next
    Ok so I tried the wget command on the linux
    this is what i got
    -bash-3.2# wget http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    --2011-07-02 23:23:42--  http://www.webservicesx.net/CurrencyConvertor.asmx?WDSL
    Resolving www.webservicesx.net... 216.8.179.25
    Connecting to www.webservicesx.net|216.8.179.25|:80... connected.
    HTTP request sent, awaiting response... 403 Forbidden
    2011-07-02 23:23:43 ERROR 403: Forbidden.

  • Not a valid location for this request

    Having set up the iCal server based on Apple's instructions, I find:
    Enabling calendaring for a user in WGM does not stick, at least according to the dialog.
    When I try to publish a calendar for user 'hansen', I get the following:
    http://[email protected]/calendars/users/Test.ics is not a valid location for this request.
    What gives?
    Thanks.

    Thank you, Harry.
    The non-sticking indication is the result of an error in your setup. DNS should be correct to allow the calendar server to find your server at www2.rc.org
    I have no problem finding the server via a web browser.
    Additionally, iCal server should have your server entered in its setup panel on port 8008 or 8443 depending on the use of nonSSL or SSL. Ensure the correct port is open.
    8008 is open. I can also see the /calendar data by logging on via a web browser.
    And lastly your OD master LDAP directory needs to be up and running at 127.0.0.1.
    So your user can be assigned within the LDAP directory and not the local directory containing server assignments.
    You got me here. Now, I tried to enable the OD service and set up the server as a master. But I can't change the user to using OD - I get an error.
    Looking in the OD General settings, I notice that the inverse DNS has given it the the host name list.rc.org, which is another name for the same server. Could that be a problem? I need list.rc.org to be available.
    I just started this server (moved from 10.4), so it's not like I've had chance to mess up much. The accounts I'm trying to use for iCal are new accounts, not imported from 10.4.

  • Publishing iCal: getting error "is not a valid location for this request"

    I am trying to publish an iCal calendar to my own website via my iSP. My isp says they are already WebDAV so I don't need to turn it on. I have also gone over my url with them repeatedly to make sure I am entering it correctly. And still, I am getting an error that publish failed because it is not a valid location for the request.
    Any advice welcome...

    Ignore this question. My webhost who has insisted for the past 45 minutes they ARE WebDAV enabled, actually aren't!

  • Daily Business Intelligence Administrator is not a valid responsibility for

    Hi there
    I am trying to access the Business Intelligence through Daily Business Intelligence Administrator responsibility I am getting following error.
    Daily Business Intelligence Administrator is not a valid responsibility for the current user. Please contact your System Administrator.
    How I am going to find out that Business Intelligence is fully installed and enable?
    Thanks
    ASIM

    Try using the FUNCTIONAL ADMINISTRATOR responsibility.
    Navigate to core services > caching > global components (can't remember if that's exactly the right names)
    Then press the clear cache button.
    Sometimes you get this error if you haven't performed these steps.

  • ShoppingCartException:This site is not a valid site for given Bill to

    Hi all
    I got following error when i tried to checkout from billing page. I have only changed the bill to contact and the I have changed any bill to addr then tried to checkout. please help me why this is happening.If I haven't changed the contact I am able to checkout.
    oracle.apps.ibe.shoppingcart.quote.ShoppingCartException: This site is not a valid site for given Bill to Customer Account/Customer Account.
    at oracle.apps.ibe.shoppingcart.quote.ShoppingCart.checkUpdateTimestamp(ShoppingCart.java) at oracle.apps.ibe.shoppingcart.quote.ShoppingCart.savePaymentInformation(ShoppingCart.java:4192) at oracle.apps.ibe.shoppingcart.quote.ShoppingCart.savePaymentInformation(ShoppingCart.java:3788) at oracle.apps.ibe.shoppingcart.quote.ShoppingCart.saveInvoicePayment(ShoppingCart.java:4699) at oa_html._xxdhm__cartChkoutpShipBill._jspService(_xxdhm__cartChkoutpShipBill.java:2493) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119) at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385) at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259) at oracle.jsp.JspServlet.internalService(JspServlet.java:178) at oracle.jsp.JspServlet.service(JspServlet.java:148) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456) at org.apache.jserv.JServConnection.run(JServConnection.java:294) at java.lang.Thread.run(Thread.java:595)
    thanks
    Surendran

    Mary,
    We've had the problem you describe above. We also found that the problem is related with computers with low resources like memory. I hope this can be useful.

Maybe you are looking for

  • Not able to connecct SSH

    Hi I configured Cisco ASA5510 firewall, but i am facing the problem with ssh login, i gave ssh for inside and outside access, but i am getting "server ... error" i enabled LOCAL  for the authentication for ssh and HTTP. and i am able to acees the dev

  • OBIEE 11G standalone isnatlaltion ISSUE

    Hi Experts, I installed 1) Database, RCU and then from OBIEE isntalaltion software I just installed BIPUBLISHER. After instalaltion xmlserver :7001 came up and I was able to open weblogic also But when I restarted the system and tried to acess the xm

  • Pricing Procedure in Sales Order

    Hi everyone, I realize this question has been posted a couple of times before but I am posting the question really after doing all my research and trying all my options. Order Type: ZOR has Doc. Pricing Proc: A while Billing Type: ZF2 has Doc. Pricin

  • Show in Finder intermittent

    Good Morning: When highlighting a clip or still in the viewer, a right click normally produces the option of "show in finder", second from the top. Certain, I can't determine a pattern, clips & stills do not give this option. If I go to the Finder an

  • Transaction data in CRM_DNO_MONITOR

    Hi All, How can i retreive the text entered in the transaction data into my smartforms.SAP by itself is not getting the text.Where can i find the details which is present in transaction data. Regards, ABhishek