Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink selects a wrong MongoDB collection for querying
EclipseLink selects a wrong MongoDB collection for querying [message #1717836] Thu, 17 December 2015 08:39
Philip Choi is currently offline Philip ChoiFriend
Messages: 1
Registered: December 2015
Junior Member
I have a collection in MongoDB named IMAGE.files.

And, I have an Entity class, called Image:
@Entity
@NoSql(dataFormat=DataFormatType.MAPPED,dataType="IMAGE.files")
public class Image {
	
	@Id
	@GeneratedValue
	@Field(name="_id")
	private String id;
	
	@Field(name="filename")
	private String filename;
		
	public Image() {
		super();
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

}


Here is the code snippet of the query function:
TypedQuery<Image> query = em.createQuery("SELECT o FROM Image o WHERE o.filename = :filename", Image.class);
query.setParameter("filename", filename);
result = query.getResultList();		


The function is executed without errors. However, EclipseLink selects a wrong collection, files, for querying. The correct one should be IMAGE.files.
[EL Fine]: sql: 2015-12-17 15:53:41.939--ServerSession(1371385683)--Connection(1930844915)--Thread(Thread[[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Executing MappedInteraction()
	spec => null
	properties => {mongo.operation=FIND, mongo.collection=files}
	input => [DatabaseRecord(
	IMAGE.files.filename => Penguins.jpg)]


I suspect that the problem is caused by the dataType in @NoSql annotation. It seems that EclipseLink does not allow a dot in the dataType.

Any help is appreciated.

Thanks.


Previous Topic:MOXY JSON Serialization of Polymorphic List issue
Next Topic:Why does JAXB change null to "", when @XmlValue is used for JSON?
Goto Forum:
  


Current Time: Sat Sep 21 14:06:51 GMT 2024

Powered by FUDForum. Page generated in 0.03687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top