Problem to make a PUT request to add @ManyToOne relation on JPA Spring REST

I can’t updated the record with entity relationed with @ManyToOne relationship.

I’ve two entities: Customer and City, each customer can have a City.

@Entity public class Customer {      @Id @GeneratedValue(strategy = GenerationType.AUTO)     Long id;      @DateTimeFormat(pattern = "yyyy-MM-dd")     private Date bornDate;      @ManyToOne     private City cityEntity;      private String fullName;     private String sex;     private Integer age;      // setters and getters... } 

@Entity public class City {      @Id @GeneratedValue(strategy= GenerationType.AUTO) Long id;     private String name;     private String state;     @OneToMany(mappedBy = "city") private List<Customer> customers;     // ... } 

I can use a POST request to create a new Customer omiting cityEntity parameter, but when I try a PUT request to update cityEntity a error occurs and data ins’t updated:

{ "timestamp": "2019-03-25T01:33:06.252+0000", "status": 415, "error": "Unsupported Media Type", "message": "Content type 'text/uri-list;charset=UTF-8' not supported", "path": "/api/customers/4" }

RESTED request:

enter image description here

PUT method:

  @PutMapping("/customers/{id}")     ResponseEntity<?> replaceCustomer(@RequestBody Customer newCustomer, @PathVariable Long id) throws URISyntaxException {         Customer updatedCustomer = repository.findById(id).map( customer -> {             if (newCustomer.getFullName() != null) customer.setFullName(newCustomer.getFullName());             if (newCustomer.getBornDate() != null) customer.setBornDate(newCustomer.getBornDate());             if (newCustomer.getSex() != null) customer.setSex(newCustomer.getSex());             customer.setCityEntity(newCustomer.getCityEntity());             return repository.save(customer);         })         .orElseGet(() -> {             newCustomer.setId(id);             return repository.save(newCustomer);         });          Resource<Customer> resource = assembler.toResource(updatedCustomer);         return ResponseEntity.created(new URI(resource.getId().expand().getHref())).body(resource);     } 

The links used above are valid and have yours respective content.

Question: How I make/create a record with relationship?

Solr multi-select facets occurs bad request error

I faced with a weird problem using apache solr faceting search. While selecting two facet constraints, solr respond with 400 error:

“400” Status: null: null HTTP ERROR 400

Problem accessing /solr/project/select. Reason:

null

Basically I have one index configured and number of fields indexed inside. I’m using facet for “content type” field. There is no problem at all when only one facet constraint is selected.

http://localhost:8983/solr/project/select?fl=item_id,score&fq={!tag=facet:type}ss_type:”system”&start=0&rows=10&sort=ds_created desc&facet=true&facet.sort=count&facet.limit=10&facet.mincount=1&facet.missing=false&facet.field={!ex=facet:type}ss_type&f.ss_type.facet.limit=50&wt=json&json.nl=map&q.alt=(ss_search_api_language:”sv”) (index_id:”project_nodes_index”) (hash:gf1tmd)

Problem starts where two constraints are selected:

http://localhost:8983/solr/project/select?fl=item_id,score&start=0&rows=10&sort=ds_created desc&facet=true&facet.sort=count&facet.limit=10&facet.mincount=1&facet.missing=false&facet.field={!ex=facet:type}ss_type&f.ss_type.facet.limit=50&wt=json&json.nl=map&q.alt=(ss_search_api_language:”sv”) ((({!tag=facet:type}ss_type:”system”) OR ({!tag=facet:type}ss_type:”product”))) (index_id:”project_nodes_index”) (hash:gf1tmd)

Standart modules are used: * search_api_solr * search_api * facetapi

Solr version 3.6.2

How can I create an http request like this manually or with a tool?

Hi how can I make this type of payload or HTTP request I used them to have internet without isp limitations is connected by means of a ssh account —- where can I find information about this type of HTTP requests? here I put some examples that do not work anymore I need other types of structures

here link of the payloads pastebin.com/vrsZZgba

thanks

enter image description here

US-Based Writer | 10 Years of Experience | Request Your Free Sample (Limited)

Howdy DP Community!

My name is Ben, Professional. Copywriter. Extraordinaire.

After 10+ years of professional writing, I've finally got a clear calendar and am available to take on new projects. Although exceptionally knowledgeable on finance (investments, commodities, insurance, retirement, etc.), I'm comfortable writing on practically any topic in the following formats:

  • Blog Content
  • General…

US-Based Writer | 10 Years of Experience | Request Your Free Sample (Limited)

Is it possible to request a longer Schengen visa / apply for a new one before I leave for my trip?

I recently got approved for a 15 day France-issued Schengen visa. I would also like to visit Switzerland and stay longer in France. The trip is still months away. Is it possible to request an extension, can I apply to France for a new visa, or to Switzerland? The problem is that: I would like to stay from approximately May 21 to Jun 19 (clearly less than 90 days…) But France only issued me 15 days with validity from May 14 to Jun 14. This makes it impossible to apply for another Schengen visa valid before Jun 15. What should I do here? Apply for a Switzerland Schengen visa from May 21 to Jun 19 and stay in France for the beginning part and Switzerland as intended?

Reference Request: Total Variation Between Dependent and Independent Bernoulli Processes

Let $ X$ be a random variable taking values in $ \{0,1\}^n$ with the following distribution. For each coordinate $ i$ , we have $ p_i = P(X_i = 1) = c/\sqrt n$ , where $ c$ is a (very small) constant. Coordinates $ i$ and $ j$ have positive correlations exponentially decaying in $ |i-j|$ , with prefactor $ 1/\sqrt n$ , in the following sense: writing $ p_{i,j} = P(X_i = 1, \, X_j = 1)$ , we have $ $ 0 \le p_{i,j} – p_i p_j \le c \exp(-|i-j|)/\sqrt n. $ $ This is a dependent Bernoulli process. Let $ \mu$ denote the law of this.

Also, let $ Y$ be an independent Bernoulli process with the same marginals: $ P(Y_i = 1) = p_i$ and coordinates are independent. Let $ \nu$ denote the law of this.

I want to bound the total variation distance $ \|\mu-\nu\|_\text{TV}$ . In particular, I want to show that the TV distance decays with $ c$ , ie taking $ c \to 0$ gives $ \text{TV} \to 0$ .


I am aware of the Chen-Stein method for approaching questions like this, but to me this seems better suited when the probabilities $ p_i$ are order $ 1/n$ , and so there are a Poisson number of $ 1$ s in the independent case (and the method shows that the same holds for dependent case, under certain conditions). Perhaps one can apply Stein’s method more generally?

Also, the aim of this question isn’t to get a precise answer from someone, but rather a reference or suggested method of approach. The above is a simplified version of my actual problem, but I feel that if I can get a good handle on the above, then I can convert it to my specific case.

Why recently an icnreasing number of website isn’t supporting “request desktop site” anymore?

Recently I more and more often, access websites via my mobile, just to realize a certain feature ha no (more) support on the mobile version of that site. So I request the desktop site. But even then, as soon I click on any link, the URL changes to something like m.URL.TD or having somewhere in the URL a .TD/XXX/mobile/.... So my impression is, the sites providers actively want to deny desktop site access from mobile devices. Why is that so? Especially since most of the time, I am getting denied access to specific features I intend to sue this way. And that way I feel often very dissapointed in regards of user experience not to say sometimes I get even mad about this logic, as I can’t see, why a site wouldn’t allow a user desktop access, where the user actively presses a button representing “Hey, I know my experience using this site as desktop version despite being on a mobile device might give me a bad experience.” So the experience of being denied getting that explicit requested desktop site is (at least for me) even worse.

Ideas I have come up with, why this could be done:

  • The site has an App, and wants to enforce the user to use the App instead.

    • But not all sites I noticed this recently have even an App.
    • Also, I wonder, is it that important, that their App is being used that they risk users stop using their service at all?
  • I.e. my bank denies it. But as soon you request a desktop site you get an information that continuing in desktop mode from mobile device is not supported by them, due to security risks. But you can just ignore that info and you remain on the desktop site. I am fine with that.

So given the above bullet points, I don’t really can see that this justify taking away the users agency.

So what am I missing? Or what other reasons are there that I notice this behavior recently more and more often?

AutoFill and ‘Payment Request API’ behavior in chrome

According to this guidance in Chrome Help

Chrome has 2 mechanisms that support saving the payment methods for the browser’s user: – Autofill and the Payment Request API
My Questions

  • what are the difference between them from user experience?
  • When using basic card (credit or debit card) what is the card number stored for continues use, is it stored in some chrome data repository where all the passwords to enter websites is stored?