Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:20:27+00:00 2026-06-07T02:20:27+00:00

I develop some unit tests but fail on all SQL statements, can you please

  • 0

I develop some unit tests but fail on all SQL statements, can you please look at this log and configuration?

Jul 01, 2012 4:33:05 PM
org.glassfish.persistence.common.Java2DBProcessorHelper executeDDLs
WARNING: PER01000: Got SQLException executing statement “CREATE TABLE
CAR (ID BIGINT NOT NULL, BRAND VARCHAR(255) NOT NULL, DESCRIPTION
VARCHAR(255), FUEL VARCHAR(255) NOT NU\ LL, GEARBOX VARCHAR(255) NOT
NULL, KILOMETRES INTEGER NOT NULL, MODEL VARCHAR(255) NOT NULL, PRICE
INTEGER NOT NULL, TYPE VARCHAR(255) NOT NULL, YEAR INTEGER NOT NULL,
EQUIPM\ ENT_ID BIGINT, SECURITY_ID BIGINT, PRIMARY KEY (ID))”:
java.sql.SQLSyntaxErrorException: Syntax error: Encountered “YEAR” at
line 1, column 263. Jul 01, 2012 4:33:05 PM
org.glassfish.persistence.common.Java2DBProcessorHelper executeDDLs
WARNING: PER01000: Got SQLException executing statement “CREATE TABLE
VEHICLE (ID BIGINT NOT NULL, MAKE VARCHAR(255) NOT NULL, MODEL
VARCHAR(255) NOT NULL, TRIM VARCHAR(255) \ NOT NULL, YEAR INTEGER NOT
NULL, PRIMARY KEY (ID))”: java.sql.SQLSyntaxErrorException: Syntax
error: Encountered “TRIM” at line 1, column 100. Jul 01, 2012 4:33:06
PM org.glassfish.persistence.common.Java2DBProcessorHelper executeDDLs
WARNING: PER01000: Got SQLException executing statement “ALTER TABLE
CAR ADD CONSTRAINT FK_CAR_SECURITY_ID FOREIGN KEY (SECURITY_ID)
REFERENCES SECURITY (ID)”: java.sql.SQLSy\ ntaxErrorException: ‘ALTER
TABLE’ cannot be performed on ‘CAR’ because it does not exist. Jul 01,
2012 4:33:06 PM
org.glassfish.persistence.common.Java2DBProcessorHelper executeDDLs
WARNING: PER01000: Got SQLException executing statement “ALTER TABLE
CAR ADD CONSTRAINT CAR_EQUIPMENT_ID FOREIGN KEY (EQUIPMENT_ID)
REFERENCES EQUIPMENT (ID)”: java.sql.SQLSy\ ntaxErrorException: ‘ALTER
TABLE’ cannot be performed on ‘CAR’ because it does not exist. Jul 01,
2012 4:33:06 PM com.sun.ejb.containers.BaseContainer initializeHome
INFO: EJB5181:Portable JNDI names for EJB VehicleEJB:
[java:global/classes/VehicleEJB!com.thevehiclelist.VehicleEJB,
java:global/classes/VehicleEJB] Jul 01, 2012 4:33:06 PM
com.sun.ejb.containers.BaseContainer initializeHome INFO:
EJB5181:Portable JNDI names for EJB BookEJB:
[java:global/classes/BookEJB!se.while_se.BookEJB,
java:global/classes/BookEJB] Jul 01, 2012 4:33:06 PM
com.sun.ejb.containers.BaseContainer initializeHome INFO:
EJB5181:Portable JNDI names for EJB CarEJB:
[java:global/classes/CarEJB,
java:global/classes/CarEJB!se.while_se.CarEJB] Jul 01, 2012 4:33:07 PM
org.eclipse.persistence.session.file:/tmp/gfembed468260415984552053tmp/applications/classes/_carcmsPU
WARNING: Local Exception Stack: Exception [EclipseLink-4002] (Eclipse
Persistence Services – 2.3.2.v20111125-r10461):
org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered
“TRIM” at line 1, column 39. Error Code: 20000 Call: INSERT INTO
VEHICLE (ID, MAKE, MODEL, TRIM, YEAR) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound] Query: InsertObjectQuery(Vehicle [id=1, year=2007, make=Volvo, model=V70, trim=2.4D])
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:342)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)

My persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">

    <persistence-unit name="carcmsPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/__default</jta-data-source>

        <class>se.while_se.Book</class>
        <class>se.while_se.Car</class>
        <class>com.thevehiclelist.Vehicle</class>



        <properties>
            <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:derby:MyTestDb;create=true" />
            <property name="javax.persistence.jdbc.user" value="" />
            <property name="javax.persistence.jdbc.password" value="" />
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />

        </properties>
    </persistence-unit>
</persistence>

And my pom.xml

<dependencies>
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>4.8.1</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>javax.persistence</artifactId>
                    <version>2.0.0</version>
                </dependency>
                <dependency>
                    <groupId>org.eclipse.persistence</groupId>
                    <artifactId>eclipselink</artifactId>
                    <version>2.3.2</version>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.main.extras</groupId>
                    <artifactId>glassfish-embedded-all</artifactId>
                    <version>3.1.2</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.derby</groupId>
                    <artifactId>derby</artifactId>
                    <version>10.8.2.2</version>
                    <scope>provided</scope>
                </dependency>

            </dependencies>

I dont have any clue what it can be, have tryed googling around a lot, but did not found any reference code for this thing.. Can you please see whats wrong in my configuration or advice me for some documentation?

Best regars

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:20:29+00:00Added an answer on June 7, 2026 at 2:20 am

    The very first error is that you try to create a column called YEAR, but YEAR is a reserved word in Derby. You should select another column name. The second one is that you try to create a column TRIM, also a reserved word. Here also select another column name.

    From what I can see the remaining errors are caused by the failure during the creation of the first tables.

    It might be easier and less error prone to first create the tables manually and the use your IDE to create the corresponding persistence class (Netbeans makes that very easy, I assume other IDEs have a comparable function).

    One more thing: to avoid the automatic creation of 255 character wide varchar columns you can add the desired length in the annotation. There you can also fix the database column name. Example, with a 32 char wide not null column called interiortrim in the db but trim in code:

    @Column(name = "INTERIORTRIM", nullable = false, length=32)
    private String trim;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I develop some unit tests with trying to connect to the Derby internal database
I want develop some web product with using javascript 3d library like three.js But
I develop some application that has database wery generic so really can't use it
I want to develop some kind of utility bar. I can position each element
Duplicate : https://stackoverflow.com/questions/135651/learning-unit-testing I'm trying to develop some software for my research group to
I develop some iPhone apps for clients, but I prefer working on a Linux
We develop some project in plain C (C99). But, we have one library as
Sorry, this questions sounds silly, but after developing some of my RESTful services using
I develop some native libraries for Android and use Boost libraries - just headers-based
I develop some PHP project on Linux platform. Are there any disadvantages of putting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.