#column "client_id" of relation "payments" does not exist

13 messages · Page 1 of 1 (latest)

tough notch
#

hey guys. can smb help me out? in my java project i have this entity:

@Data
@Entity
@Table(name="payments")
public class Payment {
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;

    @NotNull(message="transactionId cant be null")
    @Size(max=100,message = "transactionId too long")
    private String transactionId;

    @NotNull(message="clientId cant be null")
    @Size(max=32,message = "clientId too long")
    private String clientId;

    @Positive
    @DecimalMax(value = "99999.99")
    @Digits(integer = 5, fraction = 2)
    private BigDecimal amount;

    @NotNull(message="signature cant be null")
    @Size(max=200,message = "signature too long")
    private String signature;
}

and in my service i just use this:

        paymentRepository.save(payment);

and in my db my column is called: clientId.

and i keep getting error:

org.postgresql.util.PSQLException: ERROR: column "client_id" of relation "payments" does not exist
  Position: 40

Can smb help me out? thx

full elkBOT
#

This post has been reserved for your question.

Hey @tough notch! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

gloomy temple
#

Well, your table payments does not have a column client_id

tough notch
gloomy temple
#

... because of the clientId field

calm bone
#

if in application.properties you have spring.jpa.hibernate.ddl-auto=update and you don't have column in database but you have just added clientId then hibernate should create that column and your table should be updated in database.

#

with update the schema is updated.

#

for me in MySQL created without your error.

#

delete clientId. Let client_id to be created

gloomy temple
#

Never, ever, set ddl-auto to anything other than create-drop if you're just starting your project, or disabled when you have it running in production

#

You should write migrations yourself

calm bone
#

I guess he is in development