on 2012 Jul 04 3:10 AM
I ran through the JPA tutorial and after a little fiddling it worked locally. A couple of small problems I encountered.
When trying to create the entity for JPA in the Content diagram I got an exception. To get beyond this I needed to include the eclipselink and peristance jar files in the project. I think perhaps I only needed the persistence jar as the exception was related to this.
The second problem I encountered was when deploying the app locally, I got an exception in the app complaining that the schema DEMO did not exist. To get beyond this it seemed necessary to set the DDL generation type to Create Tables and Output Mode to Database in persistence.xml. At least this seemed to work for me, maybe there is a better way.
Now the app deploys and runs on the local server. However when I deploy it to the cloud I get a different problem. The app deplos and starts successfully, but when I try to add an Person I get the following exception:
javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [274]: inserted value too large for column: John
Error Code: 274
Call: INSERT INTO T_PERSON (ID, FIRSTNAME, LASTNAME) VALUES (?, ?, ?)
bind => [3 parameters bound]
Query: InsertObjectQuery(org.persistence.Person@71f9632f)
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
Anyone else encountered something similar?
Cheers
JohnA
Request clarification before answering.
Hi John,
I have the same problem here. I’ve created a SAPUI5 application on top of JPA. After deploying the application on the HANA cloud, I received the same error as you described. Kind of strange because the last time I deployed to the cloud server (based on MaxDB), it worked fine! I think the solution must be worked out within the EclipseLink. For now, I have a workaround…
I think you have created FirstName and LastName based on a String type. EclipseLink is transforming this type to a VARCHAR with length 1. If you declare a length for the String, it will probably work.
@Id
@GeneratedValue(strategy = AUTO)
private long id;
@Basic
@Column(length = 250)
private String firstName;
@Basic
@Column(length = 250)
private String lastName;
It's important to "Drop and Create" the table again (because you have change the definition of the Table), as mentioned by Matthias Steiner. After that, i think you can change the DDL generation back to "Create".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
11 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.