Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27 : fixed NPE in Embedded handling
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
querydsl-apt/src/test/java/com/mysema/query/domain/EmbeddedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.mysema.query.domain; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Embeddable; | ||
import javax.persistence.Embedded; | ||
import javax.persistence.Entity; | ||
import javax.persistence.MappedSuperclass; | ||
|
||
import org.junit.Test; | ||
|
||
public class EmbeddedTest { | ||
|
||
@Entity | ||
public class EntityClass extends AbstractEntity<SubEntityCode> { | ||
|
||
} | ||
|
||
@MappedSuperclass | ||
public abstract class AbstractEntity<C extends EntityCode> { | ||
|
||
@Embedded | ||
@Column(name = "code", nullable = false, unique = true) | ||
C code; | ||
} | ||
|
||
@MappedSuperclass | ||
public class EntityCode { | ||
|
||
@Column(name = "code", unique = true) | ||
String code; | ||
|
||
} | ||
|
||
@Embeddable | ||
public class SubEntityCode extends EntityCode { | ||
|
||
String property; | ||
|
||
} | ||
|
||
@Test | ||
public void EntityClass() { | ||
assertNotNull(QEmbeddedTest_EntityClass.entityClass.code.property); | ||
assertEquals(SubEntityCode.class, QEmbeddedTest_EntityClass.entityClass.code.getType()); | ||
} | ||
|
||
|
||
} |