Sitemap

Member-only story

Springboot JPA with IBMi AS400 : The Entity

1 min readOct 14, 2026

--

One of the other big roadblocks you will have when using Springboot JPA with AS400 is that when creating entities, you have to get them PERFECT or else get un-understandable errors.

To do this, I created a Groovy Script to parse the table data and autopopulate a template for the entitity. But I’ll cover that a bit later

First, when creating the entity, the easiest way is to do so like follows:

@Entity
@DynamicInsert
@Table(name = "YOUR_ENTITY", schema = "WBSPROJDE")
public class YourEntity{
...
}

YOUR_ENTITY : The name of table (not sys name) used

SCHEMA: The library being used (see library list)

You also HAVE to use @DynamicInsert if you are planning to add new data to that table.

Next, you HAVE TO have an @ID on a column. JPA will not work if you do not declare this. It can be anything that is indexed if you don’t have a key (yes, it happens in DB2 alot).

 @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, length = 25, name = "ID")
private String id;

And the rest is just like any other entity. Fill in all the columns and you are good to go. But these steps are necessary to avoid common pitfalls when doing JPA with DB2/IBMi/AS400.

--

--

API Expert
API Expert

Written by API Expert

Owen Rubel is the 'API Expert'. He is an Original Amazon team member, Creator of API Chaining(R), Leader in API Automation