Problem with @Embeddable with Jinq

67 views
Skip to first unread message

ext.rickard...@tieto.com

unread,
Apr 23, 2015, 10:06:05 AM4/23/15
to jinq-...@googlegroups.com
Hi

Do Jinq support @Embeddable classes for JPA?

I have tried to use them, but can't get it to work, here is the example in question (stripped of all none relevant code)

@Entity
public class Outer implements Serializable {

@Embedded
private Inner inner;
public Inner getInner(){
return inner;
}
}

@Embeddable
public class Inner implements Serializable {

private String sort;
public String getSort(){
return sort;
}
}

streamAll(em, Outer.class).sortedDescendingBy(o -> o.getInner().getSort());

The errors i get is:
java.lang.IllegalArgumentException: Could not analyze lambda code
...
Caused by: org.objectweb.asm.tree.analysis.AnalyzerException: Unknown method package/Inner:getSort()Ljava/lang/String; encountered
...

Doing the query in JPQL works perfectly (SELECT A FROM Outer A ORDER BY A.inner.sort DESC)

I really like the concept of Jinq moving from a C# world with Linq to Java, so i really hope you find the time, and get some support to continue developing Jinq.

Jinq

unread,
Apr 23, 2015, 3:02:09 PM4/23/15
to jinq-...@googlegroups.com
@Embedded is not supported at the moment. Give me a couple of days to figure it out.

Beniamin Dziurdza

unread,
Oct 18, 2018, 12:48:22 PM10/18/18
to Jinq

Does it work nowadays?

Jinq

unread,
Oct 18, 2018, 12:52:42 PM10/18/18
to Jinq

Beniamin Dziurdza

unread,
May 1, 2019, 10:33:06 AM5/1/19
to Jinq
Unfortunately, translation of @Embeddable that has nullable field(s) can lead to SQL query containing "field = null" instead of "field is NULL" when using lambdas such:

e -> e.creditCard.equals( creditCardExampleWithSomeNullField )  // <- still great this is greatly supported by Jjinq :)

Any solution? (I know, one can check all attributes of Embeddable instead of using .equals... but it is much more verbose and harder to maintain - refactorings etc.)

Best regards,
Beniamin

Beniamin Dziurdza

unread,
May 1, 2019, 10:52:38 AM5/1/19
to Jinq
Ideally, I would like to query by example of @Embaddable instance... Currently it is not straightforward... Similiar to the above issue is that one cannot pass null to equals:

e -> e.creditCard.equals( nullCreditCardInstance )   // here nullCreditCardInstance == null;


--
You received this message because you are subscribed to the Google Groups "Jinq" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jinq-forum+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages