我遇到了麻烦.
有一个实体分销商与实体城镇的ManyToMany关系连接:
@Entity
public class Distributor{
@ManyToMany
@JoinTable( name = "GS_DISTRIBUTOR_TOWN",
joinColumns = @JoinColumn(name = "CD_DISTRIBUTOR"),
inverseJoinColumns = @JoinColumn(name = "CD_TOWN") )
private List<Town> towns;
....
}
Run Code Online (Sandbox Code Playgroud)
然后实体城镇也与区有关
@Entity
public class Town{
@ManyToMany(mappedBy="towns")
private List<Distributor> distributors;
@ManyToOne
private District district;
....
}
Run Code Online (Sandbox Code Playgroud)
现在我必须过滤(使用jpql)所有分区中的经销商.我能怎么做?
我正在开发一个java web应用程序,我正在使用maven作为项目管理工具,现在我对这个问题感到疯狂.我尝试从我的应用程序构建一个jasper报告,这个报告由我在src/main/resources中的许多子报告组成.我尝试以下列方式加载这些子报表:
//Sub Report 1
InputStream fileSubRep1=(BufferedInputStream) getClass().getResourceAsStream("/fileSubReport1.jasper");
map.put("fileSubRep1",(JasperReport) JRLoader.loadObject(fileSubRep1));
//Sub Report 2
InputStream fileSubRep2=(BufferedInputStream) getClass().getResourceAsStream("/fileSubReport2.jasper");
map.put("fileSubRep1",(JasperReport) JRLoader.loadObject(fileSubRep2));
Run Code Online (Sandbox Code Playgroud)
问题是这个方法调用JRLoader.loadObject(fileSubRep1)会产生以下异常:
net.sf.jasperreports.engine.JRException: Error loading object from InputStream
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:248)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:228)
at it.aiemonline.report.jasper.GeneraFattureServiceImpl.createMapFileJasper(GeneraFattureServiceImpl.java:292)
at it.aiemonline.report.jasper.GeneraFattureServiceImpl.executeStreamByteFatturaPdf(GeneraFattureServiceImpl.java:890)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at it.aiemonline.utility.logger.SystemLogger.aroundExecuteLog(SystemLogger.java:187)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at …
Run Code Online (Sandbox Code Playgroud) 我开发了一个带有spring和vaadin的java web应用程序应用程序,在这个应用程序中,我使用了一些插件,如easyuploads和wizards-for-vaadin.然后我在我的pom.xml中添加了以下配置.
<dependency>
<groupId>org.vaadin.addon</groupId>
<artifactId>easyuploads</artifactId>
<version>7.0.1</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>wizards-for-vaadin</artifactId>
<version>1.1.0</version>
</dependency>
<!-- Add-On Repository -->
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
现在我正在安装artifactory(第一次)像存储库管理工具,我想为vaadin-addons添加一个远程存储库.但这不起作用:
我该如何解决?这是正确的方法吗?
我正在开发一个模块化的网络应用程序,我正在使用 Maven。我的应用程序的骨架如下:
我的应用程序的框架与共享服务模块
现在我想在 Service-App2 中导入 Service-App1 的一些类,但没有 Service-App1 依赖项(如 Module-App1、Util-App1 和外部依赖项)。
总结一下,因为在 App2 中我有一个复合持久性单元Composite Persistence Unit,并且我想在应用程序之间共享一些业务逻辑。例如,如果在 App1 中我有一个像这样的 spring 服务:
public interface ContractService {
void processSomethings();
}
@Service
public class ContractServiceImpl implements ContractService {
public void processSomethings(){
//Manage some share entities
}
}
Run Code Online (Sandbox Code Playgroud)
我想使用该方法
处理一些东西()
也在 App1 我怎样才能实现这一点?
我正在编写一个android sdk,我现在想分发它,但我的依赖项存在问题.我正在使用gradle和android studio.
我的sdk依赖于volley和gson,我将它们添加为我的sdk中的jar.当我试图在一个单独的客户端应用程序中创建一个aar或jar时,我总是会遇到崩溃,因为我的sdk试图引用齐射,因为它没有包含在aar或jar中.关于我应该怎么做的任何想法?我已经研究过制造肥胖罐子并取得了很大的成功.
我也尝试过使用下面的远程依赖项,但即使在客户端应用程序中进行gradle构建之后,仍然不包括volley和gson.这是我目前在sdk build.gradle中的内容
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.3'
}
Run Code Online (Sandbox Code Playgroud)
然后在客户端构建gradle我有
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'mysdk-1.0.0', ext:'aar')
}
Run Code Online (Sandbox Code Playgroud)
我正在使用./gradlew clean build
构建我的sdk的aar和jar任何人都可以告诉我在我自己的lib中包含依赖项的正确方法吗?
我需要对我的打印机有更多的控制权,然后我试图获得打印机的PrinterState,然后使用PrintStareReasons.我的代码如下:
public void checkPrinterStatus(){
try {
logger.info("Check -------------- ");
Thread.sleep(2000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PrintService printer = configParamPrintService.getPrintService();
logger.info("State " + printer.isAttributeCategorySupported(PrinterState.class));
Set<Attribute> attributes = getAttributes(printer);
for(Attribute attr : attributes){
logger.info(attr.getName());
}
}
public static Set<Attribute> getAttributes(PrintService printer) {
Set<Attribute> set = new LinkedHashSet<Attribute>();
//get the supported docflavors, categories and attributes
Class<? extends Attribute>[] categories = (Class<? extends Attribute>[]) printer.getSupportedAttributeCategories();
DocFlavor[] flavors = printer.getSupportedDocFlavors();
AttributeSet attributes = printer.getAttributes();
//get all the avaliable …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个 java web 应用程序,我在其中使用 mavenlike 项目管理工具。现在我的问题是,如果我以这种方式每 20 秒设置一次自动扫描的码头:
<!-- To launch embded jetty server -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${maven-jetty-plugin.version}</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
<extraClasspath>target/classes;../services/target/classes;</extraClasspath>
</webAppConfig>
<scanTargets>
<scanTarget>target/classes</scanTarget>
<scanTarget>../services/target/classes</scanTarget>
</scanTargets>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
Jetty 以正确的方式开始,事实上我得到:
[信息] 启动 Jetty 服务器
[信息] 以 20 秒的间隔启动扫描仪。
但是在第一次扫描时,我收到以下错误:
错误 ContextLoader - 上下文初始化失败
java.lang.OutOfMemoryError: PermGen 空间
我该怎么做才能解决它?
更新 1
我尝试以这种方式从我的 Eclipse Ide 增加 PermGen 空间:
但在第一次扫描后,我得到了同样的错误。
我该怎么做才能解决它?
我正在使用iReport 5.1.0和JasperReports 5.0.0构建一些报告.现在我的麻烦是大胆的风格没有出现在pdf输出中.如果我有样式化文本(例如"<b>My Text</b>"
),粗体部分在报告的输出中显示为粗体,但在pdf中不显示.我可以在pdf中加粗的唯一方法是强制该元素的pdf字体为粗体字体(例如pdfFontName ="Helvetica-Bold"),但是粗体显示整个字符串并且不允许我通过它来控制它样式标记<b>
.
我正在以这种方式导出pdf文件:
JRPdfExporter exp = new JRPdfExporter();
exp.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, namefileToExport);
exp.exportReport();
Run Code Online (Sandbox Code Playgroud)
我能怎么做?
我尝试使用鼠标单击来选择/取消选择图层。首先我的地图是这样的
单击图层后,我想选择它并突出显示
现在,如果我再次单击先前选择的图层,我想取消选择它并重置突出显示。这是我用来执行此操作的代码:
onEachFeature: function(feature,layer) {
layer.setStyle({fillOpacity: 0.0 , color: '#424a44', weight: 2});
layer.on('click', function(e) {
let isLayerAlreadySelected = // Some logic to undestand if layer alreeady selected
if(isLayerAlreadySelected)
layer.setStyle({fillOpacity: 0.0 , color: '#424a44', weight: 2});
else
layer.setStyle({fillOpacity: 0.4 , color: '#004691', weight: 3});
}
}
Run Code Online (Sandbox Code Playgroud)
但有时当我尝试取消选择以前选择的图层时,图层样式不会重置不透明度仍然存在。关于这个的一些建议?