Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 26 2017 20:07
    @remmeier banned @hibaymj
Roy
@depzor
When you use the JpaModule and try to filter on a relationship Id JPA performs an inner join query behind the scenes.
This makes it impossible to filter on a 'null' value relationship. Let say you want to retrieve all records that do not have jpa association (null) with entity X.
Something like this: "select id, name, project_id from tasks where project_id is null"
Remo
@remmeier
there is a possibibilty to swich to outer join. in some scenarios already done automatically. if the foreign key is checked for null, the join should not be nessary. an optimization for that should already be in place.
Roy
@depzor
Indeed I want to get rid of the join and use that simplified query instead
Ah I have found the optimization for this in latest version
Roy
@depzor
thanks!
duncanportelli
@duncanportelli
Hi all. I noticed that Crnk offers the @JsonApiEmbeddable annotation. Unfortunately, I haven't found any documentation defining its purpose. Does anyone have any hint on the functionality behind this please?
Remo
@remmeier
more or less the same as Jpa embeddable. It is a more recent addition. and my need one or the other update. But in general it will treat an a field as a structured object with fields on its own. that happens already implicitly in some scenarios. the annotation makes is more explicit.
Roy
@depzor
Is there an easy way within crnk to get a list with modified attributes? I am aware of the ResourceModificationFilter, but in my case I need some dynamic validations depending on the attributes that are being modified
Remo
@remmeier
just that one so far. but would be nice to have this reusable based on the filter. it is a common use case.
Xavier Lecoustillier
@DeafLight

Hi @remmeier
I have an object like this :

{
    hardwareInfo: {
        serialNumber: ""
        //...
    }
    //...
}

but using sparse fieldset on it (fields=hardwareInfo.serialNumber) fails. Am I missing something in the syntax ?
Thanks :)

Remo
@remmeier
what is the error? I'm not not quiet sure if it is already implemented for nested objects. It is one of the areas where that @JsonApiEmbeddable could be of use, mentioned just a few days ago in here.
Xavier Lecoustillier
@DeafLight
No error, the field is just not present.
Paulo Nascimento
@paulopaesnascimento
Hi @remmeier I cannot get the lastest version from bintray repository. (https://bintray.com/crnk-project/maven/crnk-core/3.3.20200920055408). Is it moved to other repo server? Tks
Victor Mosin
@vicmosin
@remmeier can crnk-project/crnk-framework#793 be merged?
Remo
@remmeier
bintray is gone😬 releases are still on jcenter and will move to maven central. the latest versions will go to github packages. for that we will also move to github actions.
if somebody has such a setup already, feel free to suggest it. otherwise should hopefully not to much trouble.
Paulo Nascimento
@paulopaesnascimento
Thanks Remo, do you know when you be able to move to maven central? thanks
Paulo Nascimento
@paulopaesnascimento
Hi All, someone know if there is any other repository available besides bintray? My build process starts with a clean slate and then it is failing now than bintray is gone. Thanks for any help.
Remo
@remmeier
work is tracked on crnk-project/crnk-framework#802. Official releases are still available on Jcenter. But bintray for latest has shutdown.
Matt12432
@Matt12432
When using crnkClient is there any way to encode the url so that square brackets are replaced? I appreciate that the documentation mentions that the tomcat setting should be changed to allow square brackets however I think the infrastructure team that I work with will refuse to change this setting so I'm wondering if there is anything I can change in the code? I'm using a listener already to add additional header values however the query string uri can only be viewed. One option could be to pass the query filter in the header instead and then alter the repository to check the header as well however this feels quite convoluted. Appreciate any help thanks.
Remo
@remmeier
QuerySpecUrlMapper performs the translation to urls. it could be replaced both for client and server. give parameters a different naming scheme. but is a bit of effort to avoid a flag that makes not too much sense. no other vendor, browser has this enforcement in place.
Remo
@remmeier
fyi latest version is now also on maven central: 3.4.20210509072026
wulfcolin
@wulfcolin
Did someone work with a semi-flexible list of attributes?
Like the first two are known at compile time and can be JsonApiFields and the other are only known at runtime?
The only solution I am aware of is sth. like having an attribute/JsonApiField of type JsonNode and everything there can be flexible. But I'd like to have it as first class citizen.
Remo
@remmeier
JsonAnySetter may help, should be in the doc
Remo
@remmeier
or generate the resources at runtime
Steve Brush
@brushs
what is the best example available for implementing Bulk operations?
Remo
@remmeier
what are you looking for? there is the bulk repository and the operator module. which aldo work together. there is some doc, unit tests and maybe something in crnk example.
Steve Brush
@brushs
someone I work with came across something I can't explain -- an "include=resource" fails (on a @ManyToOne relationship) -- though the query the filter generates works if take it outside of that context, only in the context it's being executed it returns a new instance of the resource, and it generates a ResourceNotFoundException (showing the id of the resource, which does exist) -- is this a known issue? Is there another way to include many to ones?
1 reply
Joe Gaudet
@joegaudet
Hey guys, I was just looking into evaluating tthis library as an option for writing a client over an existing json:api. A problem I’m running into is that the wire format is all in kabab-case and I can’t seem to find anything in the documentation that explains how to handle transforming that into Java standard camelcase with a serializer/deserializer or something of that sort.
Is there something I’m missing.
Joe Gaudet
@joegaudet
The library looks great so far otherwise, I just can’t seem to sort this part out.
Joe Gaudet
@joegaudet
Ok, so I’ve figured out that we can use the jackson annotations to rename the field, however this creates trouble when trying to use the include directive.
@JsonApiResource(type = "restaurants")
@Data
public class Restaurant {

    @JsonApiId
    private Long id;

    @JsonProperty
    private String name;

    @JsonProperty(value = "thumbnail-image-url")
    private String thumbnailImageUrl;

    @JsonApiRelation
    @JsonProperty(value = "active-menu")
    private Menu activeMenu;
}

@JsonApiResource(type="menus")
@Data
public class Menu {

    @JsonApiId
    private Long id;

    @JsonProperty
    private String name;

    @JsonApiRelation
    private Restaurant restaurant;

}

        QuerySpec querySpec = new QuerySpec(Restaurant.class);
        querySpec.includeRelation(Arrays.asList("active-menu"));
        ResourceList<Restaurant> all = restaurantRepository.findAll(querySpec);
Fails with the following:
Failed to resolve path to field 'active-menu' from class ee.food.crnk.resources.Restaurant
Joe Gaudet
@joegaudet
If I change the ‘as list’ directive to use “activeMenu” everything works, but the wireformat ends up being wrong in the ‘include’ fragment.
Actuall, ignore all that, it seems to work!
Victor Mosin
@vicmosin
@remmeier any thoughts regarding crnk-project/crnk-framework#815
Joe Gaudet
@joegaudet
Hey, running into some trouble understanding how to actually get the save implementation of a repository to make a POST
I don’t see anything obvious in the docs.
The remote server needs to assign the identifiers
    @Override
    public synchronized <S extends Project> S save(S project) {
        if (project.getId() == null) {
            project.setId(ID_GENERATOR.getAndIncrement());
        }
        projects.put(project.getId(), project);
        return project;
    }
This seems to simply stick things in a local hash.
Joe Gaudet
@joegaudet
Hrm… it seems to work tho… i don’t really get it tho.
Joe Gaudet
@joegaudet
Yet another question, that maybe someone has come across, trying to handle 422 errors from the JSONAPI spec would like to display them some how
I see this exception mapper here, but nothing clear about how to actually extend it an in a client only application
Joe Gaudet
@joegaudet
Once again, figured it out, sorry for the spam all.
filethirteen
@filethirteen
Does anyone know if there's an easy way to change the url of a crnk client? For example if you have a nested resource, if you wanted to post to the child resource your url would be {host}/parent/{parentId}/, where the ID will change depending on which parent you are trying to access? Do you have to new up an entire CrnkClient every time you want to interact with a different parent id?
Remo
@remmeier
if there is a nested resource with a matching repository, crnk client should automatically compute proper nested urls as long as the parent id is set on the resource