Browse Source
We now verify that we can actually express a valid constructor expression before rewriting queries to use constructor expressions. See #3929pull/3940/head
6 changed files with 85 additions and 5 deletions
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright 2025 the original author or authors. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.data.jpa.domain.sample; |
||||
|
||||
/** |
||||
* @author Mark Paluch |
||||
*/ |
||||
public class Country { |
||||
|
||||
private final String code; |
||||
|
||||
// workaround to avoid DTO projections as needsCustomConstruction is false.
|
||||
private Country(Country other) { |
||||
this.code = other.code; |
||||
} |
||||
|
||||
private Country(String code) { |
||||
this.code = code; |
||||
} |
||||
|
||||
public static Country of(String code) { |
||||
return new Country(code); |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue