Entity retrieval throws IllegalStateException when using EntityManager's createNamedQuery but succeds using facadeREST.find()With Eclipselink/JPA, can I have a Foreign Composite Key that shares a field with a Primary Composite Key?Wrong ordering in generated table in jpaComplex order by in JPQLJava JPA (EclipseLink) How to receive the next GeneratedValue before persisting actual entity?JPA : OpenJPA : The id class specified by type does not match the primary key fields of the classHow can I use put method to insert data to my MySQL databse using restful webserviceException by com.sun.istack.SAXException2 AND javax.xml.bind.JAXBExceptionHibernate : Why FetchType.LAZY-annotated collection property eagerly loading?com.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'since Java 10.0 NullPointer while searching for persistence - JPA eclipselink 2.6.5
What does "see" in "the Holy See" mean?
"Hello World" as 'prove.web' program source code in Knuth's WEB to test a WEB's pascal to javascript compiler
Is it legal for private citizens to "impound" e-scooters?
Marrying a second woman behind your wife's back: is it wrong and can Quran/Hadith prove this?
Why/when is AC-DC-AC conversion superior to direct AC-Ac conversion?
AC contactor 1 pole or 2?
Why isn't there a serious attempt at creating a third mass-appeal party in the US?
Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it
How do we explain the E major chord in this progression?
Why are so many countries still in the Commonwealth?
Giant space birds hatching out of planets; short story
Is it normal practice to screen share with a client?
What is the difference between 1/3, 1/2, and full casters?
TSA asking to see cell phone
Where to place an artificial gland in the human body?
Spoken encryption
How do professional electronic musicians/sound engineers combat listening fatigue?
Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?
Iterate over non-const variables in C++
Is there anything wrong with Thrawn?
When going by a train from Paris to Düsseldorf (Thalys), can I hop off in Köln and then hop on again?
Request for a Latin phrase as motto "God is highest/supreme"
How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?
Is my employer paying me fairly? Going from 1099 to W2
Entity retrieval throws IllegalStateException when using EntityManager's createNamedQuery but succeds using facadeREST.find()
With Eclipselink/JPA, can I have a Foreign Composite Key that shares a field with a Primary Composite Key?Wrong ordering in generated table in jpaComplex order by in JPQLJava JPA (EclipseLink) How to receive the next GeneratedValue before persisting actual entity?JPA : OpenJPA : The id class specified by type does not match the primary key fields of the classHow can I use put method to insert data to my MySQL databse using restful webserviceException by com.sun.istack.SAXException2 AND javax.xml.bind.JAXBExceptionHibernate : Why FetchType.LAZY-annotated collection property eagerly loading?com.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'since Java 10.0 NullPointer while searching for persistence - JPA eclipselink 2.6.5
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am definitely missing something here. My problem is this:
I get the following exception:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: entity.Book[ bookId=null ]
when trying to run a named query though the EntityManager
.
I have a RESTful service oriented Java web app, which comprises a series of xxxFacadeREST
files (e.g. BookFacadeREST
), each containing the services (create, edit, remove, find etc) for the given xxx entity (e.g. Book
). I am trying to retrieve an entity while inside a create service/method for another entity (e.g. try to retrieve a BookType
while inside BookFacadeREST.create()
). My usual approach to this is to use the EntityManager
, being initialised by my PersistenceContext
, and execute a named query, like this:
BookType bt = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter(....) etc etc
However, as already mentioned, I get an IllegalStateException
when doing this. Instead, if I try to retrieve the BookType
through calling its own FacadeREST
's find()
method, everything works. Now, what makes this strange is that I use named queries all over the place without problems. I even use one earlier in the same create method to retrieve another entity, and it works. So something must be amiss concerning the way Book
and BookType
are set up (I am assuming).
public class BookFacadeREST extends AbstractFacade<Book>
@EJB
private BookTypeFacadeREST bookTypeFacadeREST;
@PersistenceContext(unitName = "bla bla")
private EntityManager em;
@POST
public Book create(Book entity)
// works fine
if (entity.getLibraryId() != null)
lib = em.createNamedQuery("Library.findByLibraryId", Library.class).setParameter("libraryId", entity.getLibraryId().getLibraryId()).getSingleResult();
....
if (entity.getTypeId() != null)
....
else
BookType defaultType = bookTypeFacadeREST.find(new Long(1L));
// For some reason retrieving the book type using em.createNamedQuery DOES NOT WORK !!!
//BookType defaultType = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter("typeId", new Long(1L)).getSingleResult();
entity.setTypeId(defaultType);
defaultType.addBook(entity);
.....
return super.create(entity);
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book")
@XmlRootElement
public class Book implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "bookId")
private Long bookId;
@JoinColumn(name = "typeId", referencedColumnName = "typeId")
@ManyToOne(optional = false)
@NotNull
private BookType typeId;
@JoinColumn(name = "libraryId", referencedColumnName = "libraryId")
@ManyToOne(optional = false)
private Library libraryId;
.....
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book_type")
@XmlRootElement
@NamedQueries(
@NamedQuery(name = "BookType.findByTypeId", query = "SELECT b FROM BookType b WHERE b.typeId = :typeId"))
public class BookType implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "typeId")
private Long typeId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "name")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "typeId")
private List<Book> bookList;
....
Why is it that retrieving through the EntityManager
fails, while calling the find service (GET) for a specific BookType
id works, bearing in mind that the
lib = em.createNamedQuery("Library.findByLibraryId", Library.class)....
also works.
Thank you all in advance.
java jpa ejb
add a comment |
I am definitely missing something here. My problem is this:
I get the following exception:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: entity.Book[ bookId=null ]
when trying to run a named query though the EntityManager
.
I have a RESTful service oriented Java web app, which comprises a series of xxxFacadeREST
files (e.g. BookFacadeREST
), each containing the services (create, edit, remove, find etc) for the given xxx entity (e.g. Book
). I am trying to retrieve an entity while inside a create service/method for another entity (e.g. try to retrieve a BookType
while inside BookFacadeREST.create()
). My usual approach to this is to use the EntityManager
, being initialised by my PersistenceContext
, and execute a named query, like this:
BookType bt = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter(....) etc etc
However, as already mentioned, I get an IllegalStateException
when doing this. Instead, if I try to retrieve the BookType
through calling its own FacadeREST
's find()
method, everything works. Now, what makes this strange is that I use named queries all over the place without problems. I even use one earlier in the same create method to retrieve another entity, and it works. So something must be amiss concerning the way Book
and BookType
are set up (I am assuming).
public class BookFacadeREST extends AbstractFacade<Book>
@EJB
private BookTypeFacadeREST bookTypeFacadeREST;
@PersistenceContext(unitName = "bla bla")
private EntityManager em;
@POST
public Book create(Book entity)
// works fine
if (entity.getLibraryId() != null)
lib = em.createNamedQuery("Library.findByLibraryId", Library.class).setParameter("libraryId", entity.getLibraryId().getLibraryId()).getSingleResult();
....
if (entity.getTypeId() != null)
....
else
BookType defaultType = bookTypeFacadeREST.find(new Long(1L));
// For some reason retrieving the book type using em.createNamedQuery DOES NOT WORK !!!
//BookType defaultType = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter("typeId", new Long(1L)).getSingleResult();
entity.setTypeId(defaultType);
defaultType.addBook(entity);
.....
return super.create(entity);
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book")
@XmlRootElement
public class Book implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "bookId")
private Long bookId;
@JoinColumn(name = "typeId", referencedColumnName = "typeId")
@ManyToOne(optional = false)
@NotNull
private BookType typeId;
@JoinColumn(name = "libraryId", referencedColumnName = "libraryId")
@ManyToOne(optional = false)
private Library libraryId;
.....
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book_type")
@XmlRootElement
@NamedQueries(
@NamedQuery(name = "BookType.findByTypeId", query = "SELECT b FROM BookType b WHERE b.typeId = :typeId"))
public class BookType implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "typeId")
private Long typeId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "name")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "typeId")
private List<Book> bookList;
....
Why is it that retrieving through the EntityManager
fails, while calling the find service (GET) for a specific BookType
id works, bearing in mind that the
lib = em.createNamedQuery("Library.findByLibraryId", Library.class)....
also works.
Thank you all in advance.
java jpa ejb
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32
add a comment |
I am definitely missing something here. My problem is this:
I get the following exception:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: entity.Book[ bookId=null ]
when trying to run a named query though the EntityManager
.
I have a RESTful service oriented Java web app, which comprises a series of xxxFacadeREST
files (e.g. BookFacadeREST
), each containing the services (create, edit, remove, find etc) for the given xxx entity (e.g. Book
). I am trying to retrieve an entity while inside a create service/method for another entity (e.g. try to retrieve a BookType
while inside BookFacadeREST.create()
). My usual approach to this is to use the EntityManager
, being initialised by my PersistenceContext
, and execute a named query, like this:
BookType bt = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter(....) etc etc
However, as already mentioned, I get an IllegalStateException
when doing this. Instead, if I try to retrieve the BookType
through calling its own FacadeREST
's find()
method, everything works. Now, what makes this strange is that I use named queries all over the place without problems. I even use one earlier in the same create method to retrieve another entity, and it works. So something must be amiss concerning the way Book
and BookType
are set up (I am assuming).
public class BookFacadeREST extends AbstractFacade<Book>
@EJB
private BookTypeFacadeREST bookTypeFacadeREST;
@PersistenceContext(unitName = "bla bla")
private EntityManager em;
@POST
public Book create(Book entity)
// works fine
if (entity.getLibraryId() != null)
lib = em.createNamedQuery("Library.findByLibraryId", Library.class).setParameter("libraryId", entity.getLibraryId().getLibraryId()).getSingleResult();
....
if (entity.getTypeId() != null)
....
else
BookType defaultType = bookTypeFacadeREST.find(new Long(1L));
// For some reason retrieving the book type using em.createNamedQuery DOES NOT WORK !!!
//BookType defaultType = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter("typeId", new Long(1L)).getSingleResult();
entity.setTypeId(defaultType);
defaultType.addBook(entity);
.....
return super.create(entity);
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book")
@XmlRootElement
public class Book implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "bookId")
private Long bookId;
@JoinColumn(name = "typeId", referencedColumnName = "typeId")
@ManyToOne(optional = false)
@NotNull
private BookType typeId;
@JoinColumn(name = "libraryId", referencedColumnName = "libraryId")
@ManyToOne(optional = false)
private Library libraryId;
.....
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book_type")
@XmlRootElement
@NamedQueries(
@NamedQuery(name = "BookType.findByTypeId", query = "SELECT b FROM BookType b WHERE b.typeId = :typeId"))
public class BookType implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "typeId")
private Long typeId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "name")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "typeId")
private List<Book> bookList;
....
Why is it that retrieving through the EntityManager
fails, while calling the find service (GET) for a specific BookType
id works, bearing in mind that the
lib = em.createNamedQuery("Library.findByLibraryId", Library.class)....
also works.
Thank you all in advance.
java jpa ejb
I am definitely missing something here. My problem is this:
I get the following exception:
java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: entity.Book[ bookId=null ]
when trying to run a named query though the EntityManager
.
I have a RESTful service oriented Java web app, which comprises a series of xxxFacadeREST
files (e.g. BookFacadeREST
), each containing the services (create, edit, remove, find etc) for the given xxx entity (e.g. Book
). I am trying to retrieve an entity while inside a create service/method for another entity (e.g. try to retrieve a BookType
while inside BookFacadeREST.create()
). My usual approach to this is to use the EntityManager
, being initialised by my PersistenceContext
, and execute a named query, like this:
BookType bt = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter(....) etc etc
However, as already mentioned, I get an IllegalStateException
when doing this. Instead, if I try to retrieve the BookType
through calling its own FacadeREST
's find()
method, everything works. Now, what makes this strange is that I use named queries all over the place without problems. I even use one earlier in the same create method to retrieve another entity, and it works. So something must be amiss concerning the way Book
and BookType
are set up (I am assuming).
public class BookFacadeREST extends AbstractFacade<Book>
@EJB
private BookTypeFacadeREST bookTypeFacadeREST;
@PersistenceContext(unitName = "bla bla")
private EntityManager em;
@POST
public Book create(Book entity)
// works fine
if (entity.getLibraryId() != null)
lib = em.createNamedQuery("Library.findByLibraryId", Library.class).setParameter("libraryId", entity.getLibraryId().getLibraryId()).getSingleResult();
....
if (entity.getTypeId() != null)
....
else
BookType defaultType = bookTypeFacadeREST.find(new Long(1L));
// For some reason retrieving the book type using em.createNamedQuery DOES NOT WORK !!!
//BookType defaultType = em.createNamedQuery("BookType.findByTypeId", BookType.class).setParameter("typeId", new Long(1L)).getSingleResult();
entity.setTypeId(defaultType);
defaultType.addBook(entity);
.....
return super.create(entity);
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book")
@XmlRootElement
public class Book implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "bookId")
private Long bookId;
@JoinColumn(name = "typeId", referencedColumnName = "typeId")
@ManyToOne(optional = false)
@NotNull
private BookType typeId;
@JoinColumn(name = "libraryId", referencedColumnName = "libraryId")
@ManyToOne(optional = false)
private Library libraryId;
.....
@Entity
@Multitenant(value = TABLE_PER_TENANT)
@TenantTableDiscriminator(type = SCHEMA, contextProperty = MULTITENANT_PROPERTY_DEFAULT)
@Table(name = "book_type")
@XmlRootElement
@NamedQueries(
@NamedQuery(name = "BookType.findByTypeId", query = "SELECT b FROM BookType b WHERE b.typeId = :typeId"))
public class BookType implements Serializable
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "typeId")
private Long typeId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 50)
@Column(name = "name")
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "typeId")
private List<Book> bookList;
....
Why is it that retrieving through the EntityManager
fails, while calling the find service (GET) for a specific BookType
id works, bearing in mind that the
lib = em.createNamedQuery("Library.findByLibraryId", Library.class)....
also works.
Thank you all in advance.
java jpa ejb
java jpa ejb
asked Mar 26 at 17:31
zerzevulzerzevul
1031 silver badge6 bronze badges
1031 silver badge6 bronze badges
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32
add a comment |
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363076%2fentity-retrieval-throws-illegalstateexception-when-using-entitymanagers-createn%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363076%2fentity-retrieval-throws-illegalstateexception-when-using-entitymanagers-createn%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It might have something to do with the one calling the create service not passing a correct Book object. More specifically, I saw that the service gets called with a Book object that does not contain a BookType reference (even though the field is marked as NotNull). Maybe because there is no such object, the EntityManager does not get to load the BookType class info (or something like that) and when it tries to create a NamedQuery pertaining to BookType, it fails. But if I call find from BookTypeFacadeREST, then the class info finally gets loaded and it works. Can anyone make sense of this?
– zerzevul
Apr 2 at 16:32