-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for #173 - Ability to use a MappedSuperClass without being enhanc…
…ed as long as it doesn't have persistent fields
- Loading branch information
Showing
11 changed files
with
164 additions
and
60 deletions.
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
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
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
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
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
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
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
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
29 changes: 29 additions & 0 deletions
29
src/test/java/com/avaje/ebeaninternal/server/deploy/TestNotEnhancedMappedSuper.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,29 @@ | ||
package com.avaje.ebeaninternal.server.deploy; | ||
|
||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import com.avaje.ebean.BaseTestCase; | ||
import com.avaje.ebean.Ebean; | ||
import com.avaje.tests.model.basic.ResetBasicData; | ||
import com.avaje.tests.model.mappedsuper.ASimpleBean; | ||
|
||
public class TestNotEnhancedMappedSuper extends BaseTestCase { | ||
|
||
@Test | ||
public void simpleBean_mappedSuperNotEnhanced_ok() { | ||
|
||
// //GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.mappedsuper"); | ||
|
||
ResetBasicData.reset(); | ||
|
||
ASimpleBean bean = new ASimpleBean(); | ||
bean.setName("junk"); | ||
|
||
Ebean.save(bean); | ||
|
||
Assert.assertNotNull(bean.getId()); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/test/java/com/avaje/tests/model/mappedsuper/ASimpleBean.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,30 @@ | ||
package com.avaje.tests.model.mappedsuper; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
|
||
@Entity | ||
public class ASimpleBean extends NotEnhancedMappedSuper { | ||
|
||
@Id | ||
Long id; | ||
|
||
String name; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/test/java/com/avaje/tests/model/mappedsuper/NotEnhancedMappedSuper.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,32 @@ | ||
package com.avaje.tests.model.mappedsuper; | ||
|
||
import javax.persistence.MappedSuperclass; | ||
import javax.persistence.Transient; | ||
|
||
@MappedSuperclass | ||
public abstract class NotEnhancedMappedSuper { | ||
|
||
public static String SOMETHING = "Hello"; | ||
|
||
private transient Long one; | ||
|
||
@Transient | ||
private Long two; | ||
|
||
public Long getOne() { | ||
return one; | ||
} | ||
|
||
public void setOne(Long one) { | ||
this.one = one; | ||
} | ||
|
||
public Long getTwo() { | ||
return two; | ||
} | ||
|
||
public void setTwo(Long two) { | ||
this.two = two; | ||
} | ||
|
||
} |