NullOrInvalidEntityRule - entity metadata is always null (Kundera mongo 3.12)
See original GitHub issueNullOrInvalidEntityRule - metadata is always null
public boolean validate(E entity)
{
if (entity != null)
{
// entity metadata could be null.
if (entityMetadata == null)
{
throw new IllegalArgumentException(
"Entity object is invalid, operation failed. Please check previous log message for details");
}
return false;
}
// will return false if entity is null.
return true;
}
@Data
@Entity
@Table(name = "person", schema = "testDB@defaultPersistenceUnit")
public class Person {
@Id
@Column(name = "id")
private String id;
private String name;
}
final EntityManagerFactory defaultPersistenceUnit = Persistence.createEntityManagerFactory("defaultPersistenceUnit");
final EntityManager entityManager = defaultPersistenceUnit.createEntityManager();
final Person person = new Person();
entityManager.persist(person);
return ok(Json.toJson(person));
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="kundera.nodes" value="localhost"/>
<property name="kundera.port" value="27017"/>
<property name="kundera.keyspace" value="testDB"/>
<property name="kundera.dialect" value="mongodb"/>
<property name="kundera.annotations.scan.package" value="models"/>
<property name="kundera.ddl.auto.prepare" value="create"/>
<property name="kundera.client.lookup.class" value="com.impetus.client.mongodb.MongoDBClientFactory"/>
</properties>
</persistence-unit>
</persistence>
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Kundera No Entity metadata found for the class - Stack Overflow
When I got this I checked: <class>package.name.DaoClass</class>. was defined in persistence.xml, this resolved the error. Also check
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@limpid-kzonix Thanks for the feedback. We will update wiki accordingly.
@limpid-kzonix,
Also, mention entity classes and
<exclude-unlisted-classes>true</exclude-unlisted-classes>inpersistence.xmlCheck sample -https://github.com/Impetus/Kundera/wiki/Using-Kundera-with-Play!-Framework#write-persistencexml
And mention schema in Entity
Example:
@Table(name = "users", schema = "KunderaExamples@cassandra_pu")