|  | 
|  | 1 | +/* | 
|  | 2 | + * SPDX-License-Identifier: Apache-2.0 | 
|  | 3 | + * Copyright Red Hat Inc. and Hibernate Authors | 
|  | 4 | + */ | 
|  | 5 | +package org.hibernate.orm.test.secondarytable; | 
|  | 6 | + | 
|  | 7 | +import jakarta.persistence.Column; | 
|  | 8 | +import jakarta.persistence.Entity; | 
|  | 9 | +import jakarta.persistence.GeneratedValue; | 
|  | 10 | +import jakarta.persistence.Id; | 
|  | 11 | +import jakarta.persistence.SecondaryTable; | 
|  | 12 | +import jakarta.persistence.Table; | 
|  | 13 | +import org.hibernate.annotations.JdbcType; | 
|  | 14 | +import org.hibernate.dialect.OracleDialect; | 
|  | 15 | +import org.hibernate.dialect.SQLServerDialect; | 
|  | 16 | +import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; | 
|  | 17 | +import org.hibernate.testing.orm.junit.JiraKey; | 
|  | 18 | +import org.hibernate.testing.orm.junit.Jpa; | 
|  | 19 | +import org.hibernate.testing.orm.junit.RequiresDialect; | 
|  | 20 | +import org.hibernate.testing.orm.junit.Setting; | 
|  | 21 | +import org.hibernate.type.descriptor.jdbc.NumericJdbcType; | 
|  | 22 | +import org.junit.jupiter.api.Test; | 
|  | 23 | + | 
|  | 24 | +@Jpa( | 
|  | 25 | +		annotatedClasses = {MergeCastNumericTest.Actor.class}, | 
|  | 26 | +		integrationSettings = { | 
|  | 27 | +				@Setting(name = org.hibernate.cfg.AvailableSettings.SHOW_SQL, value = "true"), | 
|  | 28 | +		} | 
|  | 29 | +) | 
|  | 30 | +@JiraKey("HHH-19749") | 
|  | 31 | +@RequiresDialect(OracleDialect.class) | 
|  | 32 | +@RequiresDialect(SQLServerDialect.class) | 
|  | 33 | +class MergeCastNumericTest { | 
|  | 34 | + | 
|  | 35 | +	@Test | 
|  | 36 | +	void test(EntityManagerFactoryScope scope) { | 
|  | 37 | +		scope.inTransaction( | 
|  | 38 | +			entityManager -> { | 
|  | 39 | +				Actor actor = new Actor(); | 
|  | 40 | +				actor.salary = 5000.77d; | 
|  | 41 | + | 
|  | 42 | +				entityManager.persist( actor ); | 
|  | 43 | +				entityManager.flush(); | 
|  | 44 | +				entityManager.clear(); | 
|  | 45 | + | 
|  | 46 | +				actor = entityManager.find( Actor.class, actor.id ); | 
|  | 47 | +				actor.salary = 5000.88d; | 
|  | 48 | + | 
|  | 49 | +				entityManager.flush(); | 
|  | 50 | +				entityManager.clear(); | 
|  | 51 | +			} | 
|  | 52 | +		); | 
|  | 53 | +	} | 
|  | 54 | + | 
|  | 55 | +	@Entity(name = "actor") | 
|  | 56 | +	@Table(name = "PRINCIPAL") | 
|  | 57 | +	@SecondaryTable(name = "SECONDARY") | 
|  | 58 | +	public static class Actor { | 
|  | 59 | +		@Id | 
|  | 60 | +		@GeneratedValue | 
|  | 61 | +		private Long id; | 
|  | 62 | +		@Column(table = "SECONDARY", precision = 6, scale = 2) | 
|  | 63 | +		@JdbcType(NumericJdbcType.class) | 
|  | 64 | +		private double salary; | 
|  | 65 | +	} | 
|  | 66 | +} | 
0 commit comments