我在表中有一个列(名为“url”),其值为 URL。有些存储为“ http://www.test.com”,而另一些存储为“ blogspot.sometest.com”(顺便说一句,该表不是我的,所以我无法更改结构)。
在我的项目中,我将“url”列的内容存储为java.net.URL结构化对象的类型属性(例如 Page(String name,URL url);)。所以,如果可以的话,我不想修改这个项目。
我希望使用Hibernate能够获取具有特定 id 的单个记录。示例代码:
@Override
public T selectRow(Serializable id){
T object = null;
try {
openSession();
trns = session.beginTransaction();
criteria = session.createCriteria(cl);
criteria.add(org.hibernate.criterion.Restrictions.eq("doc_id",id));
//THIS LINE OF CODE LAUNCH THE EXCEPTION: org.hibernate.HibernateException: Unable to convert string [4bid.it] to URL : java.net.MalformedURLException: no protocol: 4bid.it
//BECAUSE FOR SOME OF THE URLS THERE IS NO PROTOCOL...
List<T> results = criteria.list();
//SAME WITH THIS
object = (T) criteria.setFirstResult((Integer) id);
//THE NEXT …Run Code Online (Sandbox Code Playgroud) 我对browserify有一些问题,我想捆绑以下 node.js 文件项目upload.js,我修改了以下代码中的文件并在 upload.js 的同一目录中调用文件 upload2.js :
var SketchfabDataApi = require( '../../index' );
var Swagger = require('swagger-client');
var fs = require('fs');
var path = require('path');
var api = new SketchfabDataApi();
function UploadModelBySketchfabdataApi(token,idinputfile) {
//var file = jQuery(idinputfile)[0].files[0];
var file = document.getElementById(idinputfile).files[0]
if (file) {
var fileName = file.name;
}
var fullPathFile = document.getElementById(idinputfile).value;
//var fullPathFile = window.location.protocol + "//" + window.location.host;
//if (window.location.port != "") fullPathFile += ":" + window.location.port + "/";
//fullPathFile = fullPathFile + '/private/' …Run Code Online (Sandbox Code Playgroud)