retrieving values from ms sql using hibernate without performing the create crud operation

I finally managed to retrieve the data from MS SQL using String to map variables with the database.

Here is the snippet of the output:

13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=137, debt_id=11432, bdrl_debt=0, debt_business_date=2020-10-13, debt_settlement_at=2020-10-13 10:51:50.0, excess_ta_debt=500, posting_ref=560820}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11476, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=618301}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=167, debt_id=11553, bdrl_debt=100, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:47:33.0, excess_ta_debt=0, posting_ref=686423}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11477, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=618302}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11510, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=881207}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=167, debt_id=11554, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:47:33.0, excess_ta_debt=500, posting_ref=686424}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11512, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=703795}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11472, bdrl_debt=0, debt_business_date=2020-10-13, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=500, posting_ref=729918}
13:55:59.553 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11473, bdrl_debt=0, debt_business_date=2020-10-13, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=500, posting_ref=729919}
13:55:59.554 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11474, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=814333}
13:55:59.554 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=165, debt_id=11551, bdrl_debt=100, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:46:50.0, excess_ta_debt=100, posting_ref=767375}
13:55:59.554 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=137, debt_id=11431, bdrl_debt=0, debt_business_date=2020-10-13, debt_settlement_at=2020-10-13 10:51:50.0, excess_ta_debt=500, posting_ref=560819}
13:55:59.554 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11518, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=500, posting_ref=689525}
13:55:59.580 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11519, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=500, posting_ref=689526}
13:55:59.580 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=169, debt_id=11557, bdrl_debt=100, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:52:57.0, excess_ta_debt=200, posting_ref=772352}
13:55:59.580 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11514, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=699984}
13:55:59.580 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=169, debt_id=11558, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:52:57.0, excess_ta_debt=600, posting_ref=772353}
13:55:59.581 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=138, debt_id=11438, bdrl_debt=100, debt_business_date=2020-10-13, debt_settlement_at=2020-10-13 10:54:50.0, excess_ta_debt=0, posting_ref=773108}
13:55:59.581 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=160, debt_id=11515, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 12:08:20.0, excess_ta_debt=200, posting_ref=699985}
13:55:59.581 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=169, debt_id=11559, bdrl_debt=0, debt_business_date=2020-10-14, debt_settlement_at=2020-10-14 13:52:57.0, excess_ta_debt=600, posting_ref=772354}
13:55:59.581 [main] DEBUG org.hibernate.internal.util.EntityPrinter - AbtMainTestControl.AbtTestObj.AbtDebtbbyCAN{debt_can=1099112400000003, debt_settlement_id=138, debt_id=11439, bdrl_debt=0, debt_business_date=2020-10-13, debt_settlement_at=2020-10-13 10:54:50.0, excess_ta_debt=500, posting_ref=773109}
13:55:59.581 [main] DEBUG org.hibernate.internal.util.EntityPrinter - More......

Entity Class

@Data
@Entity
@Table(name = "dbo.debt")
public class AbtDebtbbyCAN implements Serializable{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int debt_id;

    @Column(name = "can")
    private int debt_can;

    @Column(name = "bdrl_debt")
    private int bdrl_debt;

    @Column(name = "excess_ta_debt")
    private int excess_ta_debt;

    @Column(name = "posting_ref")
    private int posting_ref;

    @Column(name = "debt_settlement_id")
    private int debt_settlement_id;

    @Column(name = "debt_settlement_at")
    private String debt_settlement_at;

    @Column(name = "debt_business_date")
    private String debt_business_date;

}

In order for it to be printed in the output, make sure the variables are using String data type so it could be deserialized. Hope this answers your question.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top