Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364263

Summary: SQLDataSource defined in Library is not generated with initialization code.
Product: z_Archived Reporter: Xiao Bin Chen <xiaobinc>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P1 CC: chenzhh, jspadea, jvincens, svihovec, zhuzhi
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Xiao Bin Chen CLA 2011-11-21 03:06:18 EST
If you defined a sqldatasource in a library like below:

ads SQLDataSource?{@Resource {bindingkey = "mvclib", propertyFileName = "aProject"}}.

You can't use the "ads" in functions of the library. But if it was defined in the function of library. It can be used to do database action.


I debug it , and find out the ads is NULL, if defined as a field of library.
Comment 1 Tony Chen CLA 2011-11-21 03:29:01 EST
If you define a SQLDataSource in a Service, it is initialized with the annotation values. However, the same code, if put in a Library, does not have the initialization. It will through an exception when the ds is used.
Comment 2 Tony Chen CLA 2011-11-21 03:33:04 EST
---EGL code---
library DBLib
	ds SQLDataSource?{@Resource {bindingKey = "aaa"}};
	function getPosts()
	end
end

---Generated Java code---
public class DBLib extends ExecutableBase {
	private static final long serialVersionUID = 10L;
	@javax.xml.bind.annotation.XmlTransient
	public transient SQLDataSource ds;
	public DBLib() {
		super();
		ezeInitialize();
	}
	public void ezeInitialize() {
		ds = null;
	}
   .....


---Generated Java code if it is a Service----

public class DBService extends ServiceBase {
	private static final long serialVersionUID = 10L;
	@org.eclipse.edt.javart.json.Json(name="ds", clazz=SQLDataSource.class, asOptions={})
	public transient SQLDataSource ds;
	public DBService() {
		super();
		ezeInitialize();
	}
	public void ezeInitialize() {
		ds = org.eclipse.edt.runtime.java.eglx.lang.EAny.ezeCast(SysLib.getResource("aaa"), SQLDataSource.class);
	}
Comment 3 Joseph Vincens CLA 2011-11-21 12:53:23 EST
duplicate

*** This bug has been marked as a duplicate of bug 363691 ***
Comment 4 Zhi Zhu CLA 2011-11-23 00:22:48 EST
Verify against  EGL Web Developer Tools	0.7.0.v201111221542, close it