Announcement Announcement Module
No announcement yet.
DBLookups in ConversionService Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DBLookups in ConversionService

    Hi folks,

    I've got a design question about the ConversionService:

    I've got two Entities
    public class A {
    @ManyToOne(optional = false)
    private B b;
    private int alt;
    // getters/setter omitted

    public class B {
    private Long id;
    String code;
    // getters/setter omitted

    Additionally I've wrote a Parser,Printer,Formatter & add them to the ConversionService.

    At the moment I'm using the service to convert a String value into an instance of class A like this:

    A a = conversionService.convert("CC123", A.class);

    "CC" is the "code" field of class B (with must fulfill some RegExp) and
    123 is the value for field "alt" in class A

    Atm there is no database lookup to resolve "CC" with leads into that the field "id" is empty (only String value "CC" will be transfered)
    and I wanted to know if it is bad practise to build in any dependencies to database layer in the conversionService to resolve primary key for "CC"?

    Best regards,
    Last edited by Texasranger; Dec 3rd, 2012, 11:11 AM.